Odd Number function in Javascript

Something Like that:
Odd Number

add this JS code.

JS

var newArray = [];
var odd = function(num){
		return num % 2 !== 0;
}
function oddNumber(st, end){
	for(var i=st; i<=end; i++){
      newArray.push(i);
    }
}

oddNumber(15,25);
console.log(newArray.filter(odd));

[codepen_embed height="265" theme_id="0" slug_hash="XzQQXe" default_tab="js,result" user="pradeepanvi"]See the Pen Odd Number function in Javascript by Pradeep Kumar (@pradeepanvi) on CodePen.[/codepen_embed]

You can check console.

Leave a Reply

Your email address will not be published. Required fields are marked *