javascript - String is not a function -
i keep on getting "string not function" error on line five.
function swapcase(str) { var words = [] var q = str (var = 0; i<q.length; i++) { if (q(i) === q(i).tolowercase) { var upper = q(i).touppercase words.push(upper) }; else { var lower = q(i).tolowercase words.push(lower) }; }; words.join return words; }; swapcase("heleeer")
i still noobie @ coding sorry missing semi-colons , other spacing , indenting errors.
q(i)
that's function call, q
string, not function.
you can single character string using array indexing: q[i]
.
separately, want call tolowercase
, touppercase
functions.
also, words.join
has no effect, 2 reasons.
Comments
Post a Comment