Hello guys I think the following code should work but it doesn't and I don't know why, any suggestions?
It receives an array with numbers and letters and returns it with lowercase consonants. Numbers remain unchanged
Example: consonantstoLowerCase([1,5,7,'a','J','p','E'])
returns [1,5,7,'a','j',p,'E']
function consonantstoLowerCase( array )
{
var result = array.toString().replace(/[bcdfghjklmnpqrstvwxyz]/g, function (char)
{
return char.toLowerCase();
});
console.log(result)
}
OUTPUT:
consonantstoLowerCase([1,5,7,'a','J','p','E'])
=> 1,5,7,a,J,p,E
Thanks in advance!
consonantstoLowerCase([1,5,7,'a','J','p','E','k','m','I'])
function consonantstoLowerCase( array )
{
var result = array.toString().replace(/[bcdfghjklmnpqrstvwxyz]/ig, function (char)
{
return char.toLowerCase();
});
console.log(result)
}