The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> using 'every' in javascript
Joshoe1
post Jan 14 2015, 11:21 AM
Post #1





Group: Members
Posts: 3
Joined: 6-January 15
Member No.: 22,004



Hi can someone help me understand how to use the 'every' function in javascript?

from what I have been reading the syntax should go: array1.every(callbackfn[, thisArg])

so I have been trying to apply this by calling a table array, and checking if the value of each element is equal to zero and give an alert if it is.

function verifyExame()
{
var tableArray = document.getElementById('formTest')[anamneseFisico];


if (tableArray.every(value == '0', true))

{
alert ('pop');
}

}

can someone please explain this syntax a little more clearly and how it should be properly used?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Jan 14 2015, 11:44 AM
Post #2


Programming Fanatic
********

Group: Members
Posts: 5,146
Joined: 23-August 06
From: Europe
Member No.: 9



Have a look here: http://www.javascriptkit.com/jsref/arrays.shtml . It's explained in the third row of the Methods table.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Kelly008
post Apr 1 2015, 05:27 AM
Post #3


Newbie
*

Group: Members
Posts: 15
Joined: 1-April 15
Member No.: 22,440



Use a "for loop" for this purpose.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 24th April 2024 - 05:27 PM