Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

par ou impar js

function iqTest(parOuImpar){
    let splitArray = parOuImpar.split(" ")
    for (let index = 0; index < splitArray.length; index++) {
        if((splitArray[index] % 2) == 1) {
            return splitArray[index]
        }  
    }  
}

console.log(iqTest("2 4 7 8 10"))
console.log(iqTest("1 2 2"))
 
PREVIOUS NEXT
Tagged: #par #ou #impar #js
ADD COMMENT
Topic
Name
7+8 =