The most viewed posts

How to clean up Windows Computer

About Desktop Icons in Windows Computer

Driver Booster

CCleaner

some (JavaScript Array Method)

Advanced System Care

Myanmar font and keyboard for Windows

Registry Reviver

How to sell IT materials in zilastar.com

How to make a computer secure and run faster

The most viewed items

Desktop Hard Disk

Dell Inspiron 5559

HP ProBook 430

SONY Playstation Portable

Laptop RAM

External Hard Disk

Laptop

ZilaStar ICT Sep 05 2021, 19:48:42

unshift (JavaScript Array Method)

const tnwNames = ["Moe", "Soe", "Noe", "Mya"];
function tnwFun1(){
document.getElementById("demo").innerHTML = tnwNames.join(", ");
}

function tnwFun2(){
document.getElementById("demo").innerHTML = "The original array is : " + tnwNames.join(", ");
let tnwNewvalue = document.getElementById("newname").value;
tnwNames.unshift(tnwNewvalue);
document.getElementById("demo1").innerHTML = "The new array is : " + tnwNames.join(", ");
}

To see demo


ZilaStar ICT Aug 19 2021, 19:47:15

splice (JavaScript Array Method)

const tnwNames = ["Hla", "Mya", "Soe", "Moe", "Noe"];

function tnwFun1(){
document.getElementById("demo").innerHTML = tnwNames.join(", ");
}

function tnwFun2(){
document.getElementById("demo").innerHTML = "The original array is :
" + tnwNames.join(", ");
let result = tnwNames.splice(2, 2, "Aung", "Kyaw", "Tun");
document.getElementById("demo1").innerHTML = "The removed elements are :
" + result.join(", ");
document.getElementById("demo2").innerHTML = "The new array is :
" + tnwNames.join(", ");
}


ZilaStar ICT Jul 24 2021, 19:46:34

sort (JavaScript Array Method)

//1. sort alphabetically
/**
const countries = ["Myanmar", "Singapore", "Malaysia", "USA", "Thailand", "Vietname"];

function tnwFun1(){
document.getElementById("demo").innerHTML = countries.join("
");
}

function jsSort(){
let result = countries.sort();
document.getElementById("demo").innerHTML = result.join("
");
}

function jsReverse(){
let result = countries.reverse();
document.getElementById("demo").innerHTML = result.join("
");
}

//2. Sort randomly

const tnwNums = [20, 17, 30, 38, 40, 50, 28, 12];

function tnwFun1(){
document.getElementById("demo").innerHTML = tnwNums.join("
");
}

function tnwFun2(){
let result = tnwNums.sort(tnwFun3);
document.getElementById("demo").innerHTML = result.join("
");
}

function tnwFun3(a, b){
return 0.5 - Math.random();
} */

// 3. Sort Numerically

const tnwNums = [20, 17, 30, 38, 40, 50, 28, 12, 4];

function tnwFun1(){
document.getElementById("demo").innerHTML = tnwNums.join("
");
}

function jsSort(){
let result = tnwNums.sort(function(a, b){return a - b;});
document.getElementById("demo").innerHTML = result.join("
");
}

function jsReverse(){
let result = tnwNums.sort(function(a, b){return b - a;});
document.getElementById("demo").innerHTML = result.join("
");
}


ZilaStar ICT Jul 03 2021, 19:46:00

some (JavaScript Array Method)

const tnwNums = [20, 39, 48, 58, 68, 70, 85, 90];

function tnwFun1(){
document.getElementById("demo").innerHTML = tnwNums.join(", ");
}

function tnwFun2(){
let result = tnwNums.some(tnwFun3);
document.getElementById("demo").innerHTML = tnwNums.join(", ");
document.getElementById("demo1").innerHTML = result;
}

function tnwFun3(num){
let chkInput = document.getElementById("chknum").value;
return num > chkInput;
}


ZilaStar ICT Jun 13 2021, 19:45:18

slice (JavaScript Array Method)

const tnwNums = [20, 29, 30, 39, 40, 47, 50, 70];

function tnwFun1(){
document.getElementById("demo").innerHTML = tnwNums.join(", ");
}

function tnwFun2(){
let result = tnwNums.slice(1, 4);
document.getElementById("demo").innerHTML = "The original is: " + tnwNums.join(", ");
document.getElementById("demo1").innerHTML = "The new array is: " + result.join(", ");
}


ZilaStar ICT May 29 2021, 19:44:28

shift (JavaScript Array Method)

const tnwNums = [20, 30, 40, 50, 60, 70, 90];

function tnwFun1(){
document.getElementById("demo").innerHTML = tnwNums.join(", ");
}

function tnwFun2(){
let result = tnwNums.shift();
document.getElementById("demo").innerHTML = tnwNums.join(", ");
document.getElementById("demo1").innerHTML = "The removed element is: " + result;
}


ZilaStar ICT May 07 2021, 15:50:24

reverse (JavaScript Array Method)

const tnwNums = [20, 30, 40, 50, 60, 70];

function tnwFun1(){
document.getElementById("demo").innerHTML = tnwNums.join("
");
}

function tnwFun2(){
let result = tnwNums.reverse();
document.getElementById("demo").innerHTML = result.join("
");
}


ZilaStar ICT Apr 12 2021, 15:49:51

reduceRight (JavaScript Array Method)

const tnwNum = [20, 9, 20, 8, 100];

function tnwFun1(){
document.getElementById("demo").innerHTML = tnwNum.join(", ");
}

function tnwFun2(){
var result = tnwNum.reduceRight(tnwFun3);
document.getElementById("demo").innerHTML = result;
}

function tnwFun3(numRight, sum){
return numRight - sum;
}


ZilaStar ICT Mar 28 2021, 15:49:16

reduce (JavaScript Array Method)

const tnwNum = [70, 30, 20, 10, 7];

function tnwFun1(){
document.getElementById("demo").innerHTML = tnwNum.join("
");
}

function tnwFun2(){
var result = tnwNum.reduce(tnwFun3);
document.getElementById("demo").innerHTML = result;
}

function tnwFun3(leftNum, sum){
return leftNum - sum;
}


ZilaStar ICT Mar 12 2021, 15:48:32

push (JavaScript Array Method)

const tnwNames = ["Soe Soe", "Moe Moe"];

function tnwFun1(){
document.getElementById("demo").innerHTML = tnwNames.join("
");
}

function tnwFun2(){
let tnwAdd = document.getElementById("adding").value;
let result = tnwNames.push(tnwAdd);
document.getElementById("demo").innerHTML = result;
}


ZilaStar ICT Feb 15 2021, 15:47:59

pop (JavaScript Array Method)

const tnwName = ["Hla Hla", "Mya Mya", "Aung Aung", "Maung Maung"];

function tnwFun1(){
document.getElementById("demo").innerHTML = tnwName.join("
");
}

function tnwFun2(){
let result = tnwName.pop();
document.getElementById("demo").innerHTML = "The removed element is : " + result;
}


ZilaStar ICT Jan 25 2021, 15:47:26

map (JavaScript Array Method)

const tnwNum = [10, 20, 30, 40];

function tnwFun1(){
document.getElementById("demo").innerHTML = tnwNum.join("
");
}

/**
function tnwFun2(){
let result = tnwNum.map(Math.sqrt);
document.getElementById("demo").innerHTML = result.join("
");
}*/

function tnwFun2(){
let result = tnwNum.map(tnwFun3);
document.getElementById("demo").innerHTML = result.join("
");
}

function tnwFun3(num){
return num * 10;
}


Page : 8 of 30
To Contact
Available Services
Terms and Conditions