Untitled
unknown
javascript
2 years ago
1.1 kB
5
Indexable
Never
// var , let diff function student(){ var Name ="nikhil" let marks=20; if(true){ var Name ="ajay" let marks=25; console.log(marks); } console.log(Name); console.log(marks); }; student(); // classes in javascript class student { print(){ console.log("print function called"); }; constructor(){ console.log("consturctor called"); }; } let obj = new student; obj.print(); // Arrow Function const Name=()=>{ console.log("Arrow function"); }; Name(); // switch case let num =1; switch (num) { case 1: console.log("one"); break; case 2: console.log("two"); break; default: console.log("Default"); break; }; // if else shortcut method let num=true; if(true){ // regular method console.log("using regular method",true); }else{ console.log(false); }; num ? console.log("using shortcut method",true):console.log(false); // shortcut method