I have to do this simple exercise but I am really struggling a lot with it. I have to convert all the names to uppercase and pass it to the empty array, using only while loop(s), and I can't use any method, just plain javascript 5:
var names = ['rob', 'dwayne', 'james', 'larry', 'steve'];
var UpperCase = [];
I tried with an object like this (there are still some mistakes, it's just an idea):
var change = {
"mary":"MARY",
"john":"JOHN",
"james":"JAMES",
"anna":"ANNA",
"jack":"JACK",
"jeremy":"JEREMY",
"susanne":"SUSANNE",
"caroline":"CAROLINE",
"heidi":"HEIDI"
}
for(var key in change) {
var obj = change[key];
for (var prop in obj) {
var value = obj[prop];
}
}
while(names[i]===change.key) {
for(var i=0; i<names.length; i++) {
UpperCase = change.value[i];
} }
I hope somebody can help me with this one.
Thanks!