Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Get even numbers with VanillaJS

function paros(arr){
    var ret = [];
    
    for(var i = 0; i < arr.length; i++){
        var current = arr[i];
        if(current%2 === 0){
        ret.push(current);
        }
    }
    return ret;
    }

    console.log(paros([1,2,3,4,5,6,7,8]));
Source by r4nd3l.github.io #
 
PREVIOUS NEXT
Tagged: #Get #numbers #VanillaJS
ADD COMMENT
Topic
Name
3+9 =