| Welcome, Guest |
You have to register before you can post on our site.
|
| Online Users |
There are currently 2672 online users. » 0 Member(s) | 2668 Guest(s) Bing, Baidu, Yandex, Applebot
|
| Latest Threads |
SELECT statement with MS ...
Forum: MS Access SQL Tutorials
Last Post: Qomplainerz
07-27-2023, 03:35 PM
» Replies: 0
» Views: 1,918
|
SELECT statement with the...
Forum: MS Access SQL Tutorials
Last Post: Qomplainerz
07-27-2023, 03:31 PM
» Replies: 0
» Views: 1,282
|
Creating hyperlinks in HT...
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 01:23 PM
» Replies: 0
» Views: 1,637
|
What's new in HTML5?
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 12:48 PM
» Replies: 0
» Views: 1,369
|
What is HTML5?
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 12:43 PM
» Replies: 0
» Views: 1,215
|
Neck isometric exercises
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:44 AM
» Replies: 0
» Views: 1,609
|
Shoulder shrug
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:43 AM
» Replies: 0
» Views: 1,144
|
Neck retraction
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:43 AM
» Replies: 0
» Views: 1,165
|
Neck flexion and extensio...
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:42 AM
» Replies: 0
» Views: 1,275
|
Neck rotation
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:42 AM
» Replies: 0
» Views: 1,239
|
|
|
| JavaScript - Array find() example (returns the value) |
|
Posted by: Qomplainerz - 04-04-2023, 08:12 AM - Forum: JavaScript Tutorials
- No Replies
|
 |
The HTML part between the <body></body> tags looks like this:
Code: <p>Click "Test" to return the value of the first element in the array that has a value above this number:</p>
<p><input type="number" id="ageToCheck" value="18"></p>
<button onclick="myFunction()">Test</button>
<p id="demo"></p>
The JavaScript part looks like this:
Code: const ages = [4, 12, 16, 20];
function checkAge(age)
{
return age > document.getElementById("ageToCheck").value;
}
function myFunction()
{
document.getElementById("demo").innerHTML = ages.find(checkAge);
}
|
|
|
|