-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathHello_world.js
28 lines (16 loc) · 953 Bytes
/
Hello_world.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// You can write a basic "Hello World" program in JavaScript with the browser console
// To do that, type the command below in your browser console
alert("Hello World!");
// This will popup an alert that says "Hello World"
// More examples
let js = "amazing";
if (js === "amazing") alert("JavaScript is Fun!");
// This will pop up an alert that says 'JavaScript is Fun'
// In the code above, we took a variable (js) with a string of text 'amazing' and said:
// if the variable (js) is 'amazing', which it true, alert the text 'JavaScript is Fun!'
// If we change the string on the variable (js) and we try to run the program again, it won't work because the variable has being assigned to a different string. E.g
js = "boring";
if (js === "amazing") alert("JavaScript is Fun!");
// This script is false because js is no longer amazing but has been changed to boring.
// You can also do mathematical calculations in the console
20 + 30 + 20;