entries() Returns a key/value pair Array Iteration Objectevery() Checks if every element in an array pass a test in a testing function.fill() Fill the…
<!DOCTYPE html> <html> <head> <title>Js Code Testing</title> </head> <body> <button onclick = "jsFun()">Try It</button> <script> function jsFun(){ var x = document.createElement("INPUT"); x.setAttribute("type", "datetime-local"); document.body.appendChild(x); } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>Js Code Test</title> </head> <button onclick = "jsFun()">Try It</button> <body> <script> function jsFun(){ var x = document.createElement("INPUT"); x.setAttribute("type", "date"); document.body.appendChild(x); } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <button type = "button" id = "event">Try It</button> <p id = "demo"></p> <script> var x = document.getElementById("event"); x.addEventListener("mouseover", jsFun1); x.addEventListener("mousedown", jsFun2); x.addEventListener("mouseout", jsFun3); function jsFun1(){ document.getElementById("demo").innerHTML += "Mouse Over<br />"; } function jsFun2(){ document.getElementById("demo").innerHTML += "Mouse Down<br />"; } function…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo">The Date is:</p> <button type = "button" id = "test">Show Date</button> <button type = "button" id = "test1">Hide</button> <script> document.getElementById("test").addEventListener('click', jsFun); document.getElementById("test1").addEventListener('click', jsHide); function jsFun(){ document.getElementById("demo").innerHTML = Date(); } function jsHide(){ document.getElementById("demo").innerHTML = ""; } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>Js Code Testing</title> </head> <body> <button onclick = "startCount()">Start Count</button> <input type = "text" id = "txt"> <button onclick = "stopCount()">Stop Count</button> </body> <script> var c = 0; var t; var myTimer = 0; function jsFun(){ document.getElementById("txt").value = c; c++; t = setTimeout(jsFun,…
<!DOCTYPE html> <html> <head> <title>Js Code Testing</title> <style> #progressBar{ width: 100%; height: 30px; position: relative; background-color: grey; } #myBar{ width: 20px; height: 30px; position: absolute; background-color: green; } </style> </head> <body> <div id = "progressBar"> <div id = "myBar"></div> </div><p></p> <button onclick = "myMove()">Try Now</button> <script> function myMove(){ var ele = document.getElementById("myBar"); var width =…
<!DOCTYPE html> <html> <head> <title>Js Code Testing</title> </head> <body> <button onclick = "openWin()">Open Window</button> <button onclick = "moveWin()">Move Window</button> <script> function openWin(){ myWindow = window.open('', 'myWindow', 'width=300px, height=200px'); myWindow.document.write('hello'); myWindow.document.designMode = "On"; } function moveWin(){ myWindow.moveTo(500, 300); myWindow.focus(); } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>Js Code Testing</title> </head> <body> <div id = "msg"></div> <button onclick = "openWin()">Open Window</button> <button onclick = "closeWin()">Close Window</button> <button onclick = "chkStatus()">Check Status</button> <script> var myWin; function openWin(){ myWin = window.open("", "myWin", "width=300px, height=200px"); } function closeWin(){ if(myWin){ myWin.close(); } } function chkStatus(){ if(!myWin){ document.getElementById("msg").innerHTML = "Window…
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> </head> <body> <input type = "text" id = "fname" onchange = "jsFun()"> <script> function jsFun(){ var x = document.getElementById("fname"); x.value = x.value.toUpperCase(); } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> </head> <body> <select id = "myId" onchange = "jsFun()"> <option value = "#">Choose Options</option> <option value = "Thet">Thet</option> <option value = "Naing">Naing</option> <option value = "Win">Win</option> </select> <p id = "demo"></p> <script> function…
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> </head> <body> <button onclick = "jsFun()"> + </button> <script> function jsFun(){ var para = document.createElement("P"); var txtNode = document.createTextNode("Paragraph"); para.appendChild(txtNode); document.body.appendChild(para); } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> <style> #myDiv{ width: 200px; border: 2px solid red; padding: 5px; text-align: center; } </style> </head> <body> <button onclick = "jsFun()"> + </button> <p></p> <div id = "myDiv">My Example</div> <script> function jsFun(){ var para = document.createElement("P"); var txtNode = document.createTextNode("Example"); para.appendChild(txtNode); document.getElementById("myDiv").appendChild(para); } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> </head> <body> <ul id = "myText"> <li>Thet</li> <li>Naing</li> </ul> <button onclick = "jsFun()">Try It</button> <script> function jsFun(){ var node = document.createElement("LI"); var txtNode = document.createTextNode("Win"); node.appendChild(txtNode); document.getElementById("myText").appendChild(node); } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> </head> <body> <button id = "myId">Try It</button> <p id = "demo"></p> <script> var x = document.getElementById("myId"); x.addEventListener("mouseover", msOver); x.addEventListener("click", msClick); x.addEventListener("mouseout", msOut); function msOver(){ document.getElementById("demo").innerHTML += "Mouse Over <br />"; } function msClick(){ document.getElementById("demo").innerHTML += "Mouse Click <br />"; } function msOut(){ document.getElementById("demo").innerHTML…
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> </head> <body> <button id = "myId">Try It</button> <p id = "demo"></p> <script> var p1 = 9; var p2 = 9; document.getElementById("myId").addEventListener("click", function(){myFun(p1, p2)}); function myFun(num1, num2){ var x = num1 * num2; document.getElementById("demo").innerHTML = x; } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> </head> <body> <button id = "myId">Try It</button> <script> var x = document.getElementById("myId"); x.addEventListener("click", myFun1); x.addEventListener("click", myFun2); function myFun1(){ alert("Function1"); } function myFun2(){ alert("Function2"); } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> </head> <body> <h1 class = "example">Heading</h1> <p class = "example">Paragraph</p> <button onclick = "jsFun()">Try It</button> <script> function jsFun(){ var i; var x = document.querySelectorAll(".example"); for(i = 0; i < x.length; i++){ x[i].style.color = "red"; } } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> <style> </style> </head> <body> <ol> <li>Example_1</li> <li>Example_2</li> <li>Example_3</li> </ol> <button onclick = "jsFun()">Red</button> <script> function jsFun(){ var i; var x = document.getElementsByTagName("LI"); for(i = 0; i < x.length; i++){ x[i].style.color = "red"; } } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> <style> .Example{ border: 2px solid yellow; padding: 5px; width: 100px; } </style> </head> <body> <div class = "Example"> Example_1 </div> <div class = "Example"> Example_2 </div> <div class = "Example"> Example_3 </div><br /> <button style = "background: red" onclick = "colRed()">Red</button> <button style = "background: green"…
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> </head> <body> <button onclick = "jsGreen()">Green</button> <button onclick = "jsRed()">Red</button><br /> <p id = "demo"></p> <li><a href = "tnwict.com">tnwict.com</a></li> <li><a href = "tnw87.com">tnw87.com</a></li> <li><a href = "tnw87.site">tnw87.site</a></li> <script> function jsGreen(){ var i; var x = document.links; for(i = 0;…
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> <style> #myDiv{ border: 1px solid red; margin-bottom: 10px; } </style> </head> <body> <div id = "myDiv"> This is just Testing. </div> <button onclick = "jsFun()">+</button> <script> function jsFun(){ var para = document.createElement("P"); para.innerHTML = "Paragraph"; document.getElementById("myDiv").appendChild(para); } </script> </body> </html>
<html> <head> <title>Math Fun</title> <script> function registerEvents(){ document.mathWiz.operate.addEventListener('click', doTheMath, false); } function doTheMath(){ var first = parseInt(document.mathWiz.numberOne.value); var second = parseInt(document.mathWiz.numberTwo.value); var operator = document.mathWiz.operator.value; switch (operator){ case "add": var answer = first + second; break; case "substract": var answer = first - second; break; case "multiply": var answer…
JS Timer
Category : JavaScript Tutorials
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> </head> <body> <button onclick = "myTimer = setInterval(jsCount, 1000)">Start Count</button> <button onclick = "clearInterval(myTimer)">Stop Count</button> <p id = "demo"></p> <script> c = 0; function jsCount(){ document.getElementById("demo").innerHTML = ++c; } </script> </body> </html>
<!DOCTYPE html> <html> <head> <titile>Code Testing For Read More Function</titile> <style> #more{ display: none; } </style> </head> <body> <p> I am Thet Naing Win. I am 35 years old man. Now I stay in…
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> <style> body{ margin: 0px; font-size: 14px; } .header{ background-color: grey; text-align: center; padding: 12px; } #navbar{ overflow: hidden; background-color: black; } #navbar a{ display: block; float: left; padding: 16px 32px; text-decoration: none; color: white; } #navbar a:hover{ background-color: gray; } #navbar a:focus{ background-color: green; } .content{ padding: 16px; line-height: 25px; } .sticky{ position: fixed; top: 0px; width: 100%; } .sticky + .content{ padding-top: 60px; } </style> </head> <body…
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> <style> .dropdown{ display: inline-block; position: relative; } .dropbtn{ background-color: red; font-size: 14px; color: white; padding: 12px 32px; cursor: pointer; border: 2px solid green; } .dropbtn:hover, .dropbtn:focus{ background-color: orange; } .dropcontent{ display: none; overflow: auto; position: absolute; box-shadow: 0px 2px 1px 3px; } .dropcontent a{ display: block; color: white; padding: 15px 32px; text-decoration: none; background-color:…
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> <script> function startTime(){ var today = new Date(); var h = today.getHours(); var m = today.getMinutes(); var s = today.getSeconds(); m = checkTime(m); s = checkTime(s); document.getElementById("demo").innerHTML = h + ":" + m + ":"…
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> </head> <body> <p><input id = "c" onkeyup = "temperature('C')"> degree Celsius.</p> <p><input id = "f" onkeyup = "temperature('F')"> degree Fahrenheit.</p> <script> function temperature(degree){ var x; if(degree == "C"){ x = document.getElementById("c").value * 9 / 5…
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> </head> <body> <table style = "width:300px; height:100px"> <tr> <td onmouseover = "bgChange(this.style.backgroundColor)"; onmouseout = "bgChange('transparent')"; style = "background-color:red"></td> <td onmouseover = "bgChange(this.style.backgroundColor)"; onmouseout = "bgChange('transparent')"; style = "background-color:green"></td> <td…
<!DOCTYPE html> <html> <head> <title>JS Code Testing</title> <style> #mySlide{ position: relative; } li{ position: relative; list-style: none; display: block; float: left; padding: 0px 10%; width: auto; } @keyframes mymove{ from { left: 0px; } to { left: 100%; } } @-webkit-keyframes{ from { left: 0px; } to { left: 100%; } } </style> </head> <body onload…
<!DOCTYPE html> <html> <head> <title>JavaScript Statement</title> </head> <body> <p id = "demo">What is Today?</p> <button type = "button" onclick = "jsFunction()">Click Now</button> <script> function jsFunction(){ switch(new Date().getDay()){ case 0: day = "Sunday"; break; case 1: day = "Monday"; break; case 2: day = "Tuesday"; break; case 3: day = "Wednesday"; break; case 4: day…
<!DOCTYPE html> <html> <head> <title>JavaScript Statement</title> </head> <body> <h1>JavaScript Code Testing</h1> <p id = "demo1"></p> <p id = "demo2"></p> <p id = "demo3"></p> <button type = "button" onclick = "jsFunction()">Try Now</button> <script> function jsFunction(){ var you = "I like to swim."; var me =…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <script> var txt = "", i; for(i = 0; i < 10; i++){ if (i===5){continue;} txt += i + "<br />"; } document.getElementById("demo").innerHTML = txt; </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <script> var txt = "", i; for(i = 0; i < 10; i++){ if (i===5){break;} txt += i + "<br />"; } document.getElementById("demo").innerHTML = txt; </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo">Please click Random for random numbers.</p> <button type = "button" onclick = "jsRand()">Random</button> <script> function jsRand(){ var rand = Math.floor(Math.random() * 4000); document.getElementById("demo").innerHTML = rand; } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo">Click Random for random numbers.</p> <button type = "button" onclick = "myRand()">Random</button> <script> function myRand(){ var rand = jsRand(100000, 900000); document.getElementById("demo").innerHTML = rand; } function jsRand(min, max){ return Math.floor(Math.random() * (max -…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo">This is JavaScript Math.sqrt Testing</p> <button type = "button" onclick = "jsSqrt()">Math Sqrt</button> <script> var a = 81; document.getElementById("demo").innerHTML = a; function jsSqrt(){ var b = Math.sqrt(a); document.getElementById("demo").innerHTML = b; } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo">This is JavaScript Math.round Testing</p> <button type = "button" onclick = "jsRound()">Math Round</button> <script> var a = 4.576; var b = 4.345; document.getElementById("demo").innerHTML = a + " and "…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo">This is JavaScript Math.random Testing</p> <button type = "button" onclick = "jsRandom()">Math Random</button> <script> function jsRandom(){ var a = Math.random(); document.getElementById("demo").innerHTML = a; } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo">This is JavaScript Math.pow Testing</p> <button type = "button" onclick = "jsPower()">Math Power</button> <script> var a = 9; var b = 5; document.getElementById("demo").innerHTML = a + " and "…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo1">This is JavaScript Math.PI Testing</p> <button type = "button" onclick = "jsPI()">Math PI</button> <script> function jsPI(){ var pi = Math.PI; document.getElementById("demo1").innerHTML = pi; } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <script> var names = ["Maung Maung", "Aung Aung", "Mya Mya", "Hla Hla"]; var txt, i = 0; txt = "<ol>"; while(i < names.length){ txt += "<li>" + names[i] +…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <script> var names = ["Maung Maung", "Aung Aung", "Mya Mya", "Hla Hla"]; var txt; for(txt of names){ document.write("<li>" + txt + "</li>"); } </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <script> var names = ["Maung Maung", "Aung Aung", "Mya Mya", "Hla Hla"]; var i, txt; txt = "<ol>"; for(i=0; i<names.length; i++){ txt += "<li>" + names[i] + "</li>"; } txt +=…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <script> var names = ["Maung Maung", "Aung Aung", "Mya Mya", "Hla Hla"]; var i, txt; txt = "<ol>"; for(i in names){ txt += "<li>" + names[i] + "</li>"; } txt +=…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <script> function formValidate(){ var x = document.forms["myForm"]["fname"].value; if(x == ""){ alert("Must fill out in the form"); return false; } } </script> </body> <form action = "formvalidate1.html" method = "POST" onsubmit = "return formValidate()" name = "myForm"> <input type…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <input id = "demo" type = "text"> <button type = "button" onclick = "jsFun()">Check Input</button> <p id = "page"></p> <script> function jsFun(){ var sms, x; sms = document.getElementById("page"); sms.innerHTML = ""; x = document.getElementById("demo").value; try{ if(x ==…
<!DOCTYPE html> <html> <head> <title>JavaScript Cdoe Testing</title> </head> <body> <input id = "demo" type = "text"> <button type = "button" onclick = "jsFun()">Check Input</button> <p id = "page"></p> <script> function jsFun(){ var sms, x; sms = document.getElementById("page"); sms.innerHTML; x = document.getElementById("demo").value; try { if (x ==…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <button id = "btn1">Try Now</button> <p id = "demo1"></p> <button id = "btn2">Try Now</button> <p id = "demo2"></p> <script> var test1 = function(){ document.getElementById("demo1").innerHTML += this; } //window object calls the function window.addEventListener("load", test1); //button object calls…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo">Inheritance Test</p> <script> class Car{ constructor(brand){ this.carname = brand; } present(){ return "I have " + this.carname; } } class Model extends Car{ constructor(brand, mod){ super(brand); this.model = mod; } show(){ return this.present() + " and the model is "…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <script> class Car{ constructor(brand){ this.carname = brand; } get cnam(){ return this.carname; } set cnam(x){ this.carname = x; } } const myCar = new Car["Tesla"]; document.getElementById("demo").innerHTML = myCar; </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id ="demo"></p> <script> class Name{ constructor(Name, City){ this.name = Name; this.city = City; } } var newName = new Name("Thet", "Yangon"); document.getElementById("demo").innerHTML = newName.name + " stays in " + newName.city + "."; </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo">What is your name and age?</p> <button type = "button" onclick = "jsFun()">Check Name and Age</button> <script> function jsFun(){ class Name{ constructor(Name, Year){ this.name = Name; this.year = Year; } age(){ const date =…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <button type = "button" onclick = "jsReduce()">Total</button> <button type = "button" onclick = "jsReset()">Reset</button> <script> var numbers = [302, 428, 49, 92, 84, 70, 80, 10, 3,…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <button type = "button" onclick = "jsDouble()">Double</button> <button type = "button" onclick = "jsReset()">Reset</button> <button type = "button" onclick = "jsTriple()">Triple</button> <script> var numbers = [302, 428, 49,…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <script> var txt = ""; var numbers = [302, 428, 49, 92, 84, 70, 80, 10, 3, 200]; var num = numbers.sort(function (a, b){return a - b;}); txt…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo">Find the first number greater than 20</p> <button type = "button" onclick = "jsFind()">Find > 20</button> <button type = "button" onclick = "jsReset()">Reset</button> <script> var numbers = [302,…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <button type = "button" onclick = "jsFilter()">Less Than 100</button> <button type = "button" onclick = "jsReset()">Reset</button> <script> var numbers = [302, 428, 49, 92, 84, 70, 80,…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo">Sort Numberically</p> <button type = "button" onclick = "jsSort()">Sort</button> <button type = "button" onclick = "jsReverse()">Reverse</button> <script> var numbers = [400, 40, 20, 200, 93, 49]; document.getElementById("demo").innerHTML = numbers.join("<br…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <button type = "button" onclick = "jsSort()">Sort</button> <button type = "button" onclick = "jsReverse()">Reverse</button> <script> var cities = ["Yangon", "Mandalay", "Naypyidaw", "Meikhtila", "Bagan"]; document.getElementById("demo").innerHTML = cities.join(" * "); function…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <button type = "button" onclick = "jsRandom()">Sort Now</button> <script> var numbers = [300, 40, 83, 49, 92, 200, 79]; document.getElementById("demo").innerHTML = numbers.join("<br />"); function jsRandom(){ var random = numbers.sort(function(a,…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <button type = "button" onclick = "findMax()">Find Max</button> <button type = "button" onclick = "jsReset()">Reset</button> <button type = "button" onclick = "findMin()">Find Min</button> <script> var numbers = [200,…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <button type = "button" onclick = "findMax()">Find Max</button> <button type = "button" onclick = "numReset()">Reset</button> <button type = "button" onclick = "findMin()">Find Min</button> <script> var numbers = [200,…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <button id = "btn1">Try Now</button> <p id = "demo1"></p> <button id = "btn2">Try Now</button> <p id = "demo2"></p> <script> var test1 = function(){ document.getElementById("demo1").innerHTML += this; } //window object calls the function window.addEventListener("load", test1); //button object calls…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <script> var myName = {firstName : "Thet", middleName : "Naing", lastName : "Win"}; document.getElementById("demo").innerHTML = myName.firstName; </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo"></p> <script> var cities, clen, text, i; cities = ["Yangon", "Mandalay", "Naypyidaw", "Meikhtila"]; clen = cities.length; text = "<ul>"; for(i=0; i<clen; i++){ text += "<li>" + cities[i] + "</li>"; } text += "</ul>"; document.getElementById("demo").innerHTML…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo">forEach Loop</p> <script> var cities, text; cities = ["Yangon", "Mandalay", "Naypyidaw", "Meikhtila"]; text = "<ul>"; cities.forEach(jsFunction); text+= "</ul>"; function jsFunction(value){ text += "<li>" + value + "</li>"; } document.getElementById("demo").innerHTML = text; </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo1"></p> <p id = "demo2"></p> <script> //good habit in crating array var a = ["aaa", "bbb", "ccc", "ddd"]; document.getElementById("demo1").innerHTML = a; //bad habit in creating array var b = new Array("aaa",…
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo1"></p> <p id = "demo2"></p> <script> var a = ["aaa", "bbb", "ccc", "ddd"]; a[0] = "eee"; document.getElementById("demo1").innerHTML = a; var b = new Array("aaa", "bbb", "ccc", "ddd"); document.getElementById("demo2").innerHTML = b[2]; </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>JavaScript Code Testing</title> </head> <body> <p id = "demo">forEach Loop</p> <script> var cities, text; cities = ["Yangon", "Mandalay", "Naypyidaw", "Meikhtila"]; text = "<ul>"; cities.forEach(jsFunction); text+= "</ul>"; function jsFunction(value){ text += "<li>" + value + "</li>"; } document.getElementById("demo").innerHTML = text; </script> </body> </html>
VIDEO
const tnwNames = ["Moe", "Soe", "Noe", "Mya"]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwNames.join(", "); } function tnwFun2(){ document.getElementById("demo").innerHTML =…
VIDEO
const tnwNames = ["Hla", "Mya", "Soe", "Moe", "Noe"]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwNames.join(", "); } function tnwFun2(){ document.getElementById("demo").innerHTML…
VIDEO
//1. sort alphabetically /** const countries = ["Myanmar", "Singapore", "Malaysia", "USA", "Thailand", "Vietname"]; function tnwFun1(){ document.getElementById("demo").innerHTML = countries.join("<br…
VIDEO
const tnwNums = [20, 39, 48, 58, 68, 70, 85, 90]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwNums.join(",…
VIDEO
const tnwNums = [20, 29, 30, 39, 40, 47, 50, 70]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwNums.join(",…
VIDEO
const tnwNums = [20, 30, 40, 50, 60, 70, 90]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwNums.join(", "); } function…
VIDEO
const tnwNums = [20, 30, 40, 50, 60, 70]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwNums.join("<br />"); } function tnwFun2(){ …
VIDEO
const tnwNum = [20, 9, 20, 8, 100]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwNum.join(", "); } function tnwFun2(){ var…
VIDEO
const tnwNum = [70, 30, 20, 10, 7]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwNum.join("<br />"); } function tnwFun2(){ var…
VIDEO
const tnwNames = ["Soe Soe", "Moe Moe"]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwNames.join("<br />"); } function tnwFun2(){ let tnwAdd…
VIDEO
const tnwName = ["Hla Hla", "Mya Mya", "Aung Aung", "Maung Maung"]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwName.join("<br…
VIDEO
const tnwNum = [10, 20, 30, 40]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwNum.join("<br />"); } /** function tnwFun2(){ let result…
VIDEO
const tnwText = "Hello, welcome to TNW (Web Service & ICT Solutions)"; function tnwFun1(){ document.getElementById("demo").innerHTML =…
VIDEO
const tnwNames = ["Hla Hla", "Mya Mya", "Soe Soe", "Moe Moe"]; let result = ""; function tnwFun1(){ …
VIDEO
const tnwNames = ["Hla Hla", "Mya Mya", "Aung Aung", "Maung Maung"]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwNames; } function…
VIDEO
const tnwText = ["Hla Hla", "Mya Mya", "Soe Soe", "Noe Noe"]; //const tnwText = "I am…
VIDEO
const tnwText = "Hello Dear All, I am Thet Naing Win. Welcome to TNW (Web…
VIDEO
const tnwNames = ["Hla Hla", "Mya Mya", "Soe Soe", "Moe Moe"]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwNames.join("<br…
VIDEO
const myLetter = "ABCDEFGHIJKL"; function tnwFun1(){ document.getElementById("demo").innerHTML = myLetter; } function tnwFun2(){ const result = Array.from(myLetter); document.getElementById("demo").innerHTML =…
VIDEO
const student = ["Aung Aung", "Maung", "Kyaw", "Zaw", "Soe", "Moe"]; let names = ""; function tnwFun1(){ student.forEach(tnwFun2); } function…
VIDEO
const tnwAges = [19, 39, 28, 43, 29, 45, 53]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwAges.join("<br />"); } function…
VIDEO
const tnwAges = [19, 39, 28, 43, 29, 45, 53]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwAges.join("<br />"); } function…
VIDEO
const tnwAges = [25, 18, 29, 20, 40, 32, 53, 24]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwAges.join("<br…
VIDEO
const tnwNames = ["Aye Aye", "Nwe Nwe", "Hla Hla", "Mya Mya", "Soe Soe", "Moe Moe"]; function…
VIDEO
const tnwAge = [20, 29, 48, 76, 50, 38, 39]; function tnwFun1(){ document.getElementById("demo").innerHTML = tnwAge.every(tnwFun2); } function tnwFun2(chkAge){ …
VIDEO
const tnwNames = ["Hla Hla", "Mya Mya", "Aye Aye", "Nwe Nwe", "Soe Soe", "Moe Moe",…
VIDEO
const people = ["Hla", "Mya", "Aung", "Maung", "Soe", "Noe", "Moe"]; function tnwFun1(){ document.getElementById("demo").innerHTML = people.join("<br />"); } function…
VIDEO
const girls = ["Aye Aye", "Nwe Nwe", "Htwe Htwe"]; const boys = ["Aung Aung", "Maung Maung",…
VIDEO
length Sets or returns the number of elements in an array. prototype Allows you to…
VIDEO
/* const countries = ["USA", "UK", "Canada"]; document.write(countries); //example one const names = ["Hla Hla", "Mya Mya", "Soe Soe"]; document.write(names); //example…
VIDEO
Example 1 <html> <head> <title>JS Constant</title> </head> <body> <p id = "demo"></p> <script> const x = (x, y) => x * y; document.getElementById("demo").innerHTML =…
VIDEO
/* //the first character is letter var myName = "I am Thet Naing Win."; document.write(myName); //the first character is…
VIDEO
/*var a = "I am Thet Naing Win."; let b = "I am from Myanmar."; const c…
VIDEO
/*var person = { firstname : "Thet", lastname : "Naing" }; function tnwFun(){ document.getElementById("demo").innerHTML = person.lastname; }*/ var person…
VIDEO
var a = "I am Thet Naing Win."; // Statement one var b = "I am…
VIDEO
var myObj = {tree: 'green', sky: 'blue', cloud: 'white'}; myObj['sky'] = 'gray'; //here i…
VIDEO
var myObj = {tree : "green", sky : "blue", cloud : "white"}; myObj.cloud = "gray"; var myColor…
VIDEO
// 1. Access Element By Id /* function tnwFun(){ var txt = "<b>Welcome to TNW(Web Service &…
VIDEO
// 1. JavaScript is case-sensitive /* var myTest = "I am Thet Naing Win"; var mytest = "Who…
VIDEO
//There is a difference between const and let & var. //We can not use const like…
VIDEO
<!DOCTYPE html> <html> <head> <title>JavaScript OutPut</title> </head> <body> <p>alert</p> <button type = "button" onclick = "jsAlert()">Try Now</button> <p>console.log</p> <button type = "button" onclick =…
Adding script between <head> and </head> <html> <head> <title>TNW (Web Service & ICT Solutions)</title> <script> var…