Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js object some

let obj = {"num1":1, "num2":2, "num3":3, "num4":4, "num5":5};

var firstEven = null;

// Some returns a boolean value.
Object.values(obj).some((item) => {
	// Loop breaks as soon as the condition has been met.
  	// Getting your value, can be used like:
  	if	(item == 2) {
		firstEven = item;
	}
	return item % 2 == 0;
}); // Results in true
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript get string from array with space between 
Javascript :: recursive function for fibonacci series in java javascript 
Javascript :: http node 
Javascript :: how to run react builed version 
Javascript :: match the pattern in the input with javascript 
Javascript :: clear element children js 
Javascript :: AsyncStorage.getItem undefined is not an object 
Javascript :: create directory when writing to file in nodejs 
Javascript :: window.onscroll 
Javascript :: javaScript Math.log10() Method 
Javascript :: how to get element by class name javascript 
Javascript :: async javascript 
Javascript :: reload datatable 
Javascript :: function inside object javascript 
Javascript :: ping ip address using javascript 
Javascript :: axios httponly cookie 
Javascript :: js associative array push 
Javascript :: fuse.js 
Javascript :: Getting Error 404 while running npm install create-react-app 
Javascript :: •“In React, everything is a component.” Explain 
Javascript :: callback hell javascript 
Javascript :: jquery scroll to element in scrollable div 
Javascript :: react build command 
Javascript :: webpack setup proxy manual 
Javascript :: react map gl 
Javascript :: htpp code 
Javascript :: mongodb.connect is not a function 
Javascript :: how to check if user has installed pwa 
Javascript :: TypeError: Class constructor Model cannot be invoked without 
Javascript :: useeffect 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =