InterviewSolution
Saved Bookmarks
| 1. |
How to get the count of forms in a document with JavaScript? |
|
Answer» JavaScript array every METHOD checks whether the array elements (all) passes the test. A condition is checked for the test. An EXAMPLE here checks for every elements in the array for a condition passed in the function: <!DOCTYPE html> <html> <body> <script> var val = [128, 29, 28, 45]; function DISPLAY(a) { return a > 21; } document.write("Are all the values greater than 21 in the array = "+val.every(display)); </script> </body> </html>The output displays true since the condition is satisfied for all the elements of the array. |
|