The most viewed items
<!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 == "") throw "empty.";
if (isNaN(x)) throw "not a number.";
x = Number(x);
if(x < 5) throw "too small.";
if(x > 10) throw "too big.";
if(x > 4 && x < 11) throw "OK.";
}
catch (err){
sms.innerHTML = "The Input is " + err;
}
finally{
document.getElementById("demo").value;
}
}
</script>
</body>
</html>
<!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 the function
document.getElementById("btn1").addEventListener("click", test1);
var test2 = () =>{
document.getElementById("demo2").innerHTML += this;
}
//window object calls the function
window.addEventListener("load", test2);
//button object calls the function
document.getElementById("btn2").addEventListener("click", test2);
</script>
</body>
</html>
<!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 " + this.model + ".";
}
}
var myCar = new Model("Tesla", "2021");
document.getElementById("demo").innerHTML = myCar.show();
</script>
</body>
</html>
<!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 = new Date();
return date.getFullYear() - this.year;
}
}
const myName = new Name("Thet", 1987);
document.getElementById("demo").innerHTML = "My name is " + myName.name + " and my age is " + myName.age() + " years old now.";
}
</script>
</body>
</html>
<!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, 200];
var num = numbers.sort(function(a, b){return a - b;}).join("<br/>");
document.getElementById("demo").innerHTML = num;
function jsReset(){
document.getElementById("demo").innerHTML = num;
}
function jsReduce(){
var number2 = numbers.reduce(funReduce);
document.getElementById("demo").innerHTML = number2;
}
function funReduce(total, value){
return total + value;
}
</script>
</body>
</html>
<!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, 92, 84, 70, 80, 10, 3, 200];
var num = numbers.sort(function(a, b){return a - b;}).join("<br/>");
document.getElementById("demo").innerHTML = num;
function jsReset(){
document.getElementById("demo").innerHTML = num;
}
function jsDouble(){
number2 = numbers.map(mapDouble).join("<br/>");
document.getElementById("demo").innerHTML = number2;
}
function jsTriple(vlaue){
number3 = numbers.map(mapTriple).join("<br/>");
document.getElementById("demo").innerHTML = number3;
}
function mapDouble(value){
return value*2;
}
function mapTriple(value){
return value*3;
}
</script>
</body>
</html>
<!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 = "<ol>";
num.forEach(jsFunction);
document.getElementById("demo").innerHTML = txt;
function jsFunction(value){
txt += "<li>" + value + "</li><br/><hr/><br/>";
}
txt += "</ol>";
</script>
</body>
</html>
<!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, 428, 49, 92, 84, 70, 80, 10, 3, 200];
var num = numbers.sort(function(a, b){return a - b;}).join("<br/>");
document.getElementById("demo").innerHTML = num;
function jsReset(){
document.getElementById("demo").innerHTML = num;
}
function jsFind(){
var number2 = numbers.find(funFind);
document.getElementById("demo").innerHTML = number2;
}
function funFind(value){
return value > 20;
}
</script>
</body>
</html>
<!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, 10, 3, 200];
var num = numbers.sort(function(a, b){return a - b;}).join("<br/>");
document.getElementById("demo").innerHTML = num;
function jsReset(){
document.getElementById("demo").innerHTML = num;
}
function jsFilter(){
number2 = numbers.filter(funFilter).sort(function(a, b){return a - b;}).join("<br/>");
document.getElementById("demo").innerHTML = number2;
}
function funFilter(value){
return value < 100;
}
</script>
</body>
</html>
Yesterday I've successfully developed a website for April Zaw Min Com., Ltd. I want to say "Thank you so much" to April Zaw Min Com., Ltd. May their business be successful more than now!
April Zaw Min Com., Ltd is a reliable foreign agency. If you want to know more details, please visit their website (aprilzawmin.com).