Create Delete DOM

<!doctype html> <html> <head> <meta charset="utf-8"> <title>無標題文件</title> <style> *{ padding:0; margin:0; } .classBox{ width:600px; height:600px; border:2px solid black; background-color: #EDEAEA; margin: 0 auto; } .btn{ padding:20px; font-size: 24px; } .boxer{…

Move Control Dom

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>無標題文件</title> <script> var obj; var mytimer; var c=0; var y=0; var x=0; var speed=0; var player;…

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 &…