Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 1040 online users. » 0 Member(s) | 1038 Guest(s) Yandex, Bing
|
Latest Threads |
SELECT statement with MS ...
Forum: MS Access SQL Tutorials
Last Post: Qomplainerz
07-27-2023, 03:35 PM
» Replies: 0
» Views: 1,080
|
SELECT statement with the...
Forum: MS Access SQL Tutorials
Last Post: Qomplainerz
07-27-2023, 03:31 PM
» Replies: 0
» Views: 529
|
Creating hyperlinks in HT...
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 01:23 PM
» Replies: 0
» Views: 828
|
What's new in HTML5?
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 12:48 PM
» Replies: 0
» Views: 555
|
What is HTML5?
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 12:43 PM
» Replies: 0
» Views: 519
|
Neck isometric exercises
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:44 AM
» Replies: 0
» Views: 811
|
Shoulder shrug
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:43 AM
» Replies: 0
» Views: 475
|
Neck retraction
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:43 AM
» Replies: 0
» Views: 438
|
Neck flexion and extensio...
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:42 AM
» Replies: 0
» Views: 506
|
Neck rotation
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:42 AM
» Replies: 0
» Views: 478
|
|
|
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);
}
|
|
|
|