Last active
June 7, 2021 09:03
-
-
Save thisiskhan/36ba7cd39da1b3d686d4b7c45f66b5d4 to your computer and use it in GitHub Desktop.
Data Types js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Data Types: | |
Undefined, null, booleans, String, Symbols, number, and objects; | |
*/ | |
/* | |
Symbols: Symbols are immutable and are unique | |
*/ | |
const val1 = Symbol("Hello") | |
const val2 = Symbol("Hello") | |
console.log(val1 == val2) //false | |
/* | |
var : The most common variable. Can be reassigned but only accessed within a function. Variables defined with var move to the top when code is executed. | |
*/ | |
var myname = "Raza Khan"; | |
console.log(myname) | |
myname = 8 | |
console.log(myname) | |
/* | |
let : Similar to const, however, let variable can be reassigned but not re-declared. | |
*/ | |
let ourName = "UraniumMobile"; | |
/* | |
const : Cannot be reassigned and not accessible before they appear within the code. | |
*/ | |
const pi = 3.14 | |
/* | |
Objects | |
*/ | |
var person = { | |
"name" : myname, | |
"age" : 18, | |
"Expertise" : "Flutter Developer", | |
"Profession" : "Freelancer" | |
} | |
/* | |
Arrays | |
*/ | |
var fruits = ["Apple", "Mango", "🍌"] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment