As my journey in learning JavaScript programming continues I stumble on the idea how to use two dimensional array in JavaScript doing my research on the language itself I discovered JavaScript does not have it's own structure on two dimensional array or multi dimensional array as its data structure but creating two dimensional array is much easier and enjoyable learning experience on my part.
In this sample program will demonstrate to you how the basic input and output can be done using two dimensional array in JavaScript the code is very short and very simple I intended my work for beginners like me. I hope you will find my work useful.
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