Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
High Performance Python for Data Analytics
this week in the
Python
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Bear Bibeault
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
Tim Cooke
Junilu Lacar
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Jj Roberts
Carey Brown
Bartenders:
salvin francis
Frits Walraven
Piet Souris
Forum:
HTML Pages with CSS and JavaScript
Can any one tell me what this code is producing?
syed zeyad
Greenhorn
Posts: 5
posted 3 weeks ago
Number of slices to send:
Optional 'thank-you' note:
Send
const items = [ { name: 'Bike', price: 100 }, { name: 'TV', price: 200 }, { name: 'Album', price: 10 }, { name: 'Book', price: 5 }, { name: 'Phone', price: 2000 }, { name: 'Keyboard', price: 50 }, { name: 'Mouse', price: 500 }, { name: 'Computer', price: 30 }, ] const foundItem = Boolean(items.length) && items.filter(item => item.price === 10) console.log(foundItem)
what is happening in the above code?
Stephan van Hulst
Saloon Keeper
Posts: 12628
273
posted 3 weeks ago
Number of slices to send:
Optional 'thank-you' note:
Send
It prints an array containing all items from the
items
array that have a
price
of
10
. If the
items
array didn't have any items to begin with, it prints
false
.
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How can I modify the code to an exercise to pass the tests?
When to use parameters in a custom function
Difference between condition checks using if(myVar) and if(myVar=="")
Running debug on inner classes in Eclipse.
hash map error
More...