Join filtered item from an array - Javascript Array

Javascript examples for Array:join

Description

Join filtered item from an array

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from  w  w  w .j ava2  s .  c  o m
var myarr = ["red", "green", "blue", "yellow"];
var result = myarr.filter(function (item) {
    return item != "red";
}).join("");
console.log('result', result);
document.body.innerText = result;
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials