Introduction
Tutorial 2 JavaScript Basics
This tutorial gives a quick overview of the syntax and features of JavaScript language for those who have not use the language before or whose knowledge of JavaScript is a bit rusty. Some aspects of the language such as event handling and timing will be covered when they are needed. Try to run the examples in this tutorial. To run them, in most case you only need to copy the scripts into the
Note: The unshift() method does not work properly in Internet Explorer 8 and earlier.
pop(): Remove the last element of an array
Click the button to remove the last array element.
var fruits = [“Banana”, “Orange”, “Apple”, “Mango”]; function myFunction()
fruits.pop();
var x=document.getElementById(“demo”); x.innerHTML=fruits; console.log(fruits);
shift(): Remove the first element of an array
Click the button to remove the first element of the array.