Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to check multiple values in if condition in javascript

var matches = ['Argentina','Australia','Brazil','Canada','China','Colombia','France','Germany','Indonesia','India','Italy','Japan','Malaysia','Mexico','Philippines','Russia','South Africa','Sweden','Switzerland','United Kingdom','USA'];
if (~ matches.indexOf(item[i].innerText) …
Comment

how to check multiple values in if condition in javascript

var regex = /Argentina|Australia|Brazil|Canada|China|Colombia|France|Germany|Indonesia|India|Italy|Japan|Malaysia|Mexico|Philippines|Russia|South Africa|Sweden|Switzerland|United Kingdom|USA/
if (regex.test(item[i].innerText)) …
Comment

how to check multiple values in if condition in javascript

var text = item[i].innerText;
if (text === 'Argentina' | text === 'Australia' | text === 'Brazil' | text === 'Canada' | text === 'China' | text === 'Colombia' | text === 'France' | text === 'Germany' | text === 'Indonesia' | text === 'India' | text === 'Italy' | text === 'Japan' | text === 'Malaysia' | text === 'Mexico' | text === 'Philippines' | text === 'Russia' | text === 'South Africa' | text === 'Sweden' | text === 'Switzerland' | text === 'United Kingdom' | text === 'USA')
Comment

PREVIOUS NEXT
Code Example
Javascript :: removeeventlistener not working in class javascript 
Javascript :: snippets chrome devtools debugging 
Javascript :: js number 123 to string one two three 
Javascript :: ismodified function 
Javascript :: convert an iterable object to an array 
Javascript :: enum mongoose doesnt trigger error 
Javascript :: redux filter pane 
Javascript :: wait in js 
Javascript :: traduire text with api translate google in react 
Javascript :: code postal leheriya tunisie 
Javascript :: Install React Navigation dependencies into main project folder 
Javascript :: @webfilter objectify where we can use 
Javascript :: enable cors on eleventy 
Javascript :: use node-session with serverless functions 
Javascript :: how to edit local json files using node 
Javascript :: setstate before function react 
Javascript :: rails json exclude nested attribute 
Javascript :: javascript accessing this in callback 
Javascript :: 5.3.1.2. Logical OR¶ 
Javascript :: angualr js busy when routing 
Javascript :: where to put background images in react app 
Javascript :: vuex get data in mounted 
Javascript :: delete all cookies javascript 
Javascript :: F:JavascriptOOP 
Javascript :: iterating hashmap angular 
Javascript :: hack using javascript 
Javascript :: CELEBRITY PROBLEM gfg 7-18-21 
Javascript :: Destructing variable assignment 
Javascript :: javascript remove junk element from array 
Javascript :: js load inside div from file 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =