InterviewSolution
Saved Bookmarks
| 1. |
Is JavaScript case-sensitive? |
|
Answer» The array VARIABLE is to be set empty if you want to empty an array. Let’s SAY we have the following array: var myArr = ["shirt", "trousers", "WATCH"];To empty the above array, just set it to empty: myArr = [];Here we converting our array to empty array: <html> <head> <title>Empty Array in JAVASCRIPT</title> <script> var myArr = ["shirt", "trousers", "watch"]; document.write("<BR />Array: " + myArr ); // set array to empty myArr = []; document.write("<br />New array (Empty now): " + myArr ); </script> </head> <body> </body> </html>The output: Array: shirt,trousers,watch New array (Empty now): |
|