Skip to content

Commit bba9814

Browse files
author
Adria Vieira
committed
solution.js translated
1 parent 56545f4 commit bba9814

File tree

1 file changed

+4
-4
lines changed
  • 1-js/05-data-types/05-array-methods/1-camelcase/_js.view

1 file changed

+4
-4
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
function camelize(str) {
22
return str
3-
.split('-') // splits 'my-long-word' into array ['my', 'long', 'word']
3+
.split('-') // separa 'my-long-word' em um array ['my', 'long', 'word']
44
.map(
5-
// capitalizes first letters of all array items except the first one
6-
// converts ['my', 'long', 'word'] into ['my', 'Long', 'Word']
5+
// deixa as primeiras letras de todos os itens do array em maiúsculo exceto o primeiro item
6+
// converte ['my', 'long', 'word'] em ['my', 'Long', 'Word']
77
(word, index) => index == 0 ? word : word[0].toUpperCase() + word.slice(1)
88
)
9-
.join(''); // joins ['my', 'Long', 'Word'] into 'myLongWord'
9+
.join(''); // une ['my', 'Long', 'Word'] formando 'myLongWord'
1010
}

0 commit comments

Comments
 (0)