-3

//I need to do this with for

var name = ["Jhon", "Anne", "Ewreck", "Nine"];

for( var i = 0 ; i < name.length ; i++ ){
    name[i].push(name[i].toUpperCase());
    console.log(name[i]);
}
DeVector
  • 3
  • 1
  • Does this answer your question? [Convert array into upper case](https://stackoverflow.com/questions/29719329/convert-array-into-upper-case) – callback Feb 07 '21 at 13:18
  • Do not use `name` as a variable name in the window.scope `let names = ["Jhon", "Anne", "Ewreck", "Nine"]; names = names.map(name=>name.toUpperCase())` – mplungjan Feb 07 '21 at 13:22
  • Thanks, its worked. But you now if whit for its worked or not? – DeVector Feb 07 '21 at 13:26

1 Answers1

1

Try this

let name = ["Jhon", "Anne", "Ewreck", "Nine"];
let nameUpper = name.map( x => x.toUpperCase() )
console.log(nameUpper);
Ali Esmailpor
  • 1,209
  • 3
  • 11
  • 22
Rahul Arora
  • 131
  • 2