79142353

Date: 2024-10-30 18:24:44
Score: 1.5
Natty:
Report link

Can use pop method.

    var arr = [1,2,3,4];

    console.log(arr[arr.length -1]); // get the last element
    
    arr.pop(); // delete the last element
     
         (or)

    //other way for deleting the last element
    console.log(arr.splice(arr.length-1, 1));
    
    console.log(arr); // [1,2,3]

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): Can u
  • Low reputation (1):
Posted by: Ravi