It’s support is built directly into modern web browsers(So we don’t need to download anything)
It’s a full programming language unlike HTML or CSS and support things such as arrays,loops and general logic
- Number: Any number eg:1,2,2.5
- Boolean : Always one of the two word eg: true or false
console.log is used to print words to the console
- Add: +
- Subtract: -
- Multiply: *
- Divide: /
5 * 4
Modulus Operator: Shows the remainder after we divide a number
- These are lines that are not evaluated when the code runs
- Can be extremely useful when we are looking back our code we have written earlier or other people who will be looking at our code.
- Single line comment
//This is a single line comment
- Multiline comment
/* This is
a multiline comment */
Variables are used to assign data to a word then we can use that word within our program instead of the data. In future if the variable value changed we have to change the variable value instead of re-writing the entire program.
Now let’s dissect this program step-by-step
- myName is the variable name and its using camelCase convention
- = is used to assign whatever next to variable
- Prashant is the value that is equal to assign to the variable
Variables can hold any data type like strings,numbers,Booleans,arrays,functions and objects.