JS Array Shift & Unshift


Array shift()

<!DOCTYPE html>
<html>
<head>
  <title>JavaScript</title>
  <script>
    var a = ["Sanjay", "Aman", "Rehman", "Karan"];

    document.write(a + "<br><br>");
    a.shift();
    document.write(a);
  </script>
</head>
<body>
</body>
</html>


Array unshift()

<!DOCTYPE html>
<html>
<head>
  <title>JavaScript</title>
  <script>
    var a = ["Aman", "Rehman", "Karan"];

    document.write(a + "<br><br>");
    a.unshift("Rahul");
    document.write(a);
  </script>
</head>
<body>
</body>
</html>