Monday, November 16, 2015

Name and Age Display Using Two Dimensional Array in JavaScript


A simple program that demonstrate how to accept a value using two dimensional array in JavaScript and display the result on the screen.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





Program Listing


<html>
<body>
<script>
var arr  = [];

name = prompt("Enter your name");
age  = Number(prompt("Enter your age "));
var arr1 = [name,age];


arr.push(arr1);

document.write("Name : " +arr[0][0] + "<br>");
document.write("Age  : " +arr[0][1]);

</script>
</body>
</html>

No comments:

Post a Comment