Last changes
This commit is contained in:
parent
b24b05d3ca
commit
fdc015e1fa
8 changed files with 59 additions and 32 deletions
|
@ -1,3 +1,10 @@
|
|||
function camelize(str) {
|
||||
/* your code */
|
||||
}
|
||||
return str
|
||||
.split('-') // разбивает 'my-long-word' на массив ['my', 'long', 'word']
|
||||
.map(
|
||||
// Переводит в верхний регистр первые буквы всех элементом массива за исключением первого
|
||||
// превращает ['my', 'long', 'word'] в ['my', 'Long', 'Word']
|
||||
(word, index) => index == 0 ? word : word[0].toUpperCase() + word.slice(1)
|
||||
)
|
||||
.join(''); // соединяет ['my', 'Long', 'Word'] в 'myLongWord'
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue