This commit is contained in:
Ilya Kantor 2020-08-23 19:03:29 +03:00
parent 718d9df37b
commit b24b05d3ca
1436 changed files with 131 additions and 106126 deletions

View file

View file

@ -0,0 +1,2 @@
console.log("Hello");

View file

@ -0,0 +1,3 @@
function camelize(str) {
/* your code */
}

View file

@ -0,0 +1,19 @@
describe("camelize", function() {
it("leaves an empty line as is", function() {
assert.equal(camelize(""), "");
});
it("turns background-color into backgroundColor", function() {
assert.equal(camelize("background-color"), "backgroundColor");
});
it("turns list-style-image into listStyleImage", function() {
assert.equal(camelize("list-style-image"), "listStyleImage");
});
it("turns -webkit-transition into WebkitTransition", function() {
assert.equal(camelize("-webkit-transition"), "WebkitTransition");
});
});

View file

@ -0,0 +1,20 @@
importance: 5
type: js
---
# Translate border-left-width to borderLeftWidth
Write the function `camelize(str)` that changes dash-separated words like "my-short-string" into camel-cased "myShortString".
That is: removes all dashes, each word after dash becomes uppercased.
Examples:
```js
camelize("background-color") == 'backgroundColor';
camelize("list-style-image") == 'listStyleImage';
camelize("-webkit-transition") == 'WebkitTransition';
```
P.S. Hint: use `split` to split the string into an array, transform it and `join` back.