pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/Hyuk/javascript/blob/master/javascript-basics/javascript-basics/variables.md

8dd150ce6c8e711.css" /> javascript/javascript-basics/javascript-basics/variables.md at master · Hyuk/javascript · GitHub
Skip to content

Latest commit

 

History

History
100 lines (88 loc) · 1.77 KB

File metadata and controls

100 lines (88 loc) · 1.77 KB

Variables

  • undefined
  • number
  • string
  • symbol
  • object
  • function
  • boolean
  • null

JavaScript Variable Name Rule

  • Variable names are case sensitive.
  • First letter should be alphabet(a), underscore(_), dollor sign($)
  • Recommend to use camelCase when declaring a variable.
  • Shouldn't be the reserved keyword

Javascript Reserved Keyword

break | case | catch | continue default | delete | do | else false | finally | for | function
if | in | instanceof | new null | return | switch | this throw | true | try | typeof var | void | while | with

var someVariable;
let thisVariable;
const thatVariable;

undefined

var a;
console.log(a); // undefined

number

var num1 = 12;
console.log(num1); // 12
typeof num1; // "number"
var text1 = "Hello World";
console.log(text1); // "Hello World"
typeof text1; // "string"

symbol

var sym1 = Symbol('foo');
console.log(sym1); // Symbol(foo)
typeof sym1; // "symbol"
Symbol('foo') === Symbol('foo'); // false

object

var fruit = ['Apple', 'Banana', 'Orange'];
console.log(fruit); // ["Apple", "Banana", "Orange"]
typeof fruit; // "object"

function

var function1 = new Function('5 + 2');
console.log(myFun);
/*
ƒ anonymous() {
5 + 2
}
*/
typeof myFun // "function"

boolean

var flag = true;
console.log(flag); // true
typeof flag // "boolean"

null

// foo is known to exist now but it has no type or value
var foo = null;
foo // null
typeof null // "object"
typeof undefined // "undefined"
null === undefined // false
null == undefined // true
null === null // true
null == null // true
null // null
!null // true
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy