The most viewed items
<!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>
No comment to show.