Friday, December 31, 2021
The some() array works similar to the every() method, it also returns true or false when the condition is met. some() needs to match just one element in the array that meets the condition to return true. So lets run the same code that we ran for the every() method. We will test to see if the array is greater than 50 for the first condition, and then we will test to see if the array is greater than 70 for the second condition. For the every() method the first condition returns true, while the second condition returns false. Let's see what happens with the some() method.
As you can see both conditions return true because at least one of the element in the array meets the condition.
<script> var oilPrices = [70.15, 69.50, 71.23, 74.32, 76.99]; var greaterThanFifty = oilPrices.some(function (value) { return value > 50; }); var greaterThanSeventy = oilPrices.some(function (value) { return value > 70 }); console.log("greaterThanFifty: " + greaterThanFifty); console.log("greaterThanSeventy: " + greaterThanSeventy); </script>
As you can see both conditions return true because at least one of the element in the array meets the condition.
Subscribe to:
Post Comments (Atom)
Search This Blog
Tags
Web Development
Linux
Javascript
DATA
CentOS
ASPNET
SQL Server
Cloud Computing
ASP.NET Core
ASP.NET MVC
SQL
Virtualization
AWS
Database
ADO.NET
AngularJS
C#
CSS
EC2
Iaas
System Administrator
Azure
Computer Programming
JQuery
Coding
ASP.NET MVC 5
Entity Framework Core
Web Design
Infrastructure
Networking
Visual Studio
Errors
T-SQL
Ubuntu
Stored Procedures
ACME Bank
Bootstrap
Computer Networking
Entity Framework
Load Balancer
MongoDB
NoSQL
Node.js
Oracle
VirtualBox
Container
Docker
Fedora
Java
Source Control
git
ExpressJS
MySQL
NuGet
Blogger
Blogging
Bower.js
Data Science
JSON
JavaEE
Web Api
DBMS
DevOps
HTML5
MVC
SPA
Storage
github
AJAX
Big Data
Design Pattern
Eclipse IDE
Elastic IP
GIMP
Graphics Design
Heroku
Linux Mint
Postman
R
SSL
Security
Visual Studio Code
ASP.NET MVC 4
CLI
Linux Commands
Powershell
Python
Server
Software Development
Subnets
Telerik
VPC
Windows Server 2016
angular-seed
font-awesome
log4net
servlets
tomcat
AWS CloudWatch
Active Directory
Angular
Blockchain
Collections
Compatibility
Cryptocurrency
DIgital Life
DNS
Downloads
Google Blogger
Google Chrome
Google Fonts
Hadoop
IAM
KnockoutJS
LINQ
Linux Performance
Logging
Mobile-First
Open Source
Prototype
R Programming
Responsive
Route 53
S3
SELinux
Software
Unix
View
Web Forms
WildFly
XML
cshtml
githu
This comment has been removed by the author.
ReplyDeleteThank you so much for sharing very informative blog. I got more knowledge from this blog And i learn about java script from this blog anyone want learn java with data science course in Mumbai just click here
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteNice blog! Thanks for sharing such informative blog , As i am a student and doing my online training from power bi course in kolkata. Really awesome to have such course provider .
ReplyDeleteAdds one or more elements to the end of an array and returns the new length of the array.SEO Sohug
ReplyDelete