Print out every word with more than 2 lowercase letters

0 Marin BeŇ°lo · August 16, 2015
Hello, guys :D 
I have the following problem:
I have an array with 5 words, and it should print out every word with more than 2 lowercase 
letters. I first pushed them into a new array (niz2) and then wanted to print them out.
But, unfortunately, it prints only the words with the first lowercase letter. Also, it will print
only "seven", and the other not. If I set 
"if (niz >= "A" && niz <= "z")" instead of "if (niz >= "a" && niz <= "z")", it will work. 
But why doesn't it work with the code below?

var niz = ["Marin", "Aaaaaa", "Software", "1", "seven"];
var niz2 = [];


for ( var i = 0; i < niz.length; i++ ){
var counter = 0;
for ( var j = 0; j < niz.length; j++){
if (niz >= "a" && niz <= "z")
counter++;
}
if (counter > 2)
niz2.push(niz);
}
console.log(niz2);

Post a Reply

Replies

Oldest  Newest  Rating
0 Franz Schmidt · August 17, 2015
Could you please upload your code on a website like this:
http://textuploader.com/
and post the link in here.

The forum isn't compatible with arrays cause bb-codes are enabled which use square brackets for their tags (e.g.: [.i][./i] is italic)
  • 1

Javascript

107,201 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators