InterviewSolution
Saved Bookmarks
| 1. |
Convert a Date object to String in JavaScript? |
|
Answer» To remove the last element from an array in JavaScript, use the pop() method.<BR> Let’s say we have the following array: var arr = [20, 11, 44, 39, 88, 48, 89, 47 ];To remove an element, use the pop() method: var element = arr.pop();Let us see an example wherein we are removing 5 elements: The OUTPUT: Array = 20,11,44,39,88,48,89,47 Removing 5 elements... Popped Element = 47 Popped Element = 89 Popped Element = 48 Popped Element = 88 Popped Element = 39 |
|