Tree View Dom

<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> ul, #myUL { list-style-type: none; } #myUL { margin: 0; padding: 0; } .caret { cursor: pointer; -webkit-user-select: none; /* Safari…

Class

<body> <script type="text/javascript"> class Student { constructor(_name, _sid, _js, _ai, _hp, _wp, _ec) { this.name=_name; this.sid=_sid; this.js=_js; this.ai=_ai; this.hp=_hp; this.wp=_wp; this.ec=_ec; } print(){ document.write(`${this.name} \t ${this.sid} \t ${this.js} \t ${this.ai}…

176. Intl Numbers

//Intl Numbers const num = 24153251.89; const options = { style: 'currency', //It can be unit, percent or currency unit: 'celsius', currency: 'EUR', //userGrouping: false, }; console.log('US:', new Intl.NumberFormat('en-US', options).format(num));…

Creating Dates

1. const new = new Date(); console.log(now); => current time; 2. console.log(new Date('December 24, 2015')); => Thu Dec 24 2015 00:00:00 GMT+0000 3. console.log(new Date(2031,10,11,12,12,10)); 4. console.log(new Date(0)); => Thu…

Working With BigInt

console.log(Number.MAX_SAFE_INTEGER); => 9007199254740991 //When facing large numbers that are bigger than above number, Js runs into some problems. How to solve? Using BigInt console.log(BigInt(124623786189682165785218589)); => 124623786189682165785218589n //Or console.log(124623786189682165785218589n); => 124623786189682165785218589n…

Math & Rounding

console.log(Math.sqrt(25)); => 5 console.log(25 ** (1/2)); => 5 console.log(8 ** (1/3)); => 2 console.log(Math.max(5,18,23,11,2)); => 23 console.log(Math.min(5,18,23,11,2)); => 2 //Make a function that can generate random number between min &…