WIP
This commit is contained in:
parent
718d9df37b
commit
b24b05d3ca
1436 changed files with 131 additions and 106126 deletions
10
1-js/01-a/1-a1/2-runjs/solution/index.js
Normal file
10
1-js/01-a/1-a1/2-runjs/solution/index.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
function camelize(str) {
|
||||
return str
|
||||
.split('-') // splits 'my-long-word' into array ['my', 'long', 'word']
|
||||
.map(
|
||||
// capitalizes first letters of all array items except the first one
|
||||
// converts ['my', 'long', 'word'] into ['my', 'Long', 'Word']
|
||||
(word, index) => index == 0 ? word : word[0].toUpperCase() + word.slice(1)
|
||||
)
|
||||
.join(''); // joins ['my', 'Long', 'Word'] into 'myLongWord'
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue