Posts

Showing posts from December, 2021

JS Notes

Data Types in JS We assigned data to the variable by using the assignment operator "=". Datatypes in JavaScript are: Number i.e., 11,23,45,6 Strings, i.e., "Hello World." Boolean, i.e., true, false Undefined Null Any of the complex data structures (Array and Objects) Let Block level scope, it works under block { } if call outer side of block the global let value will call console . log ( 'tut3' ) ; // Variables in js // var, let, const var name = 'harry' ; var channel ; var marks = 3454 ; marks = 0 ; channel = 'CodeWithHarry' console . log ( name , channel , marks ) ; // Rules for creating JavaScript Variables /* 1. Cannot start with numbers 2. Can start with letter, numbers, _ or $ 3. Are case sensitive */ var city = 'Delhi' ; console . log ( city ) ; const ownersName = 'Hari Ram' ; // ownersName = 'Harry'; // Cannot do this (error) console . log ( ownersName ) ; const fruit = 'Oran...