Javascript is a high-level just-in-time compiled programming language that conforms to ECMAScript specification
There are 2 ways to run javascript
<script> </script>
tag - It will run when you open the HTML file in your browser.<script src='index.js'> </script>
. - It will run when you open the HTML file in your browser.$ node <filename>.js
// this is a js comment
let - a mutable variable
const - an immutable variable that always needs to be initialised
Primitive types | non-primitive types |
---|---|
String | |
const name = ‘Jeff’ |
Objects - key-value pairs |
`let person = { | |
'name':''jeff, | |
'age' = 22 | |
}` | |
Number | |
const age = 22 |
|
Boolean | |
const isNewUser = False |
|
Undefined - not assigned/defined | |
let result |
|
let result = undefined |
|
Null - empty/unknown | |
let data = null |
|
BigInt - denotes int value larger than number type can hold | |
Symbol - denotes a value that is unique & unchangeable |