CodePen ->: social development environment for front-end designers and developers.
Frameworks:
React ->: The library for web and native user interfaces.
htmx ->: htmx gives you access to AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes.
Libraries:
Leaflet.js: leading open-source JavaScript library for mobile-friendly interactive maps.
D3.js ->: The JavaScript library for bespoke
data visualization.
Chart.js ->: Simple yet flexible JavaScript charting library for the modern web.
three.js ->: a 3D library that tries to make it as easy as possible to get 3D content on a webpage.
Basics
// Variable Declarationleta=10;// Block-scopedconstb=20;// Block-scoped and constantvarc=30;// Function-scoped// Data Typesletnum=100;// Numberletstr="Hello World";// Stringletbool=true;// Booleanletarr=[1,2,3];// Arrayletobj={key:"value"};// Objectletfunc=function(){};// Functionletundef;// Undefinedletnul=null;// Null
Operators
// Arithmeticletsum=1+2;// Additionletdiff=5-3;// Subtractionletprod=2*3;// Multiplicationletquot=10/2;// Divisionletmod=10%3;// Modulus// Assignmentletx=10;x+=5;// x = x + 5x-=3;// x = x - 3x*=2;// x = x * 2x/=2;// x = x / 2// ComparisonletisEqual=(1=='1');// true (loose equality)letisStrictEqual=(1===1);// true (strict equality)letisNotEqual=(1!='1');// falseletisGreater=(5>3);// trueletisLesser=(3<5);// true
Control Structures
// Conditional Statementsif(a>b){// code if true}elseif(a===b){// code if equal}else{// code if false}// Switch Statementswitch(a){case1:// code for case 1break;case2:// code for case 2break;default:// default code}// Loops// For Loopfor(leti=0;i<5;i++){// code}// While Loopwhile(a<10){// codea++;}// Do-While Loopdo{// codea++;}while(a<10);
Functions
// Function Declarationfunctiongreet(name){return"Hello, "+name;}// Function Expressionconstgreet=function(name){return"Hello, "+name;};// Arrow Functionconstgreet=(name)=>"Hello, "+name;// Immediately Invoked Function Expression (IIFE)(function(){// code})();
Arrays
letfruits=["Apple","Banana","Cherry"];// Access ElementsletfirstFruit=fruits[0];// Array Methodsfruits.push("Orange");// Add to endfruits.pop();// Remove from endfruits.shift();// Remove from startfruits.unshift("Lemon");// Add to startletsliced=fruits.slice(1,3);// Slice array// Loop through Arrayfruits.forEach((fruit)=>console.log(fruit));
// Class DeclarationclassPerson{constructor(name,age){this.name=name;this.age=age;}greet(){return"Hello, "+this.name;}}// InheritanceclassStudentextendsPerson{constructor(name,age,grade){super(name,age);this.grade=grade;}study(){returnthis.name+" is studying.";}}letstudent=newStudent("John",20,"A");console.log(student.greet());console.log(student.study());