WIP
This commit is contained in:
parent
718d9df37b
commit
b24b05d3ca
1436 changed files with 131 additions and 106126 deletions
0
1-js/01-a/1-a1/1-camelcase/solution.md
Normal file
0
1-js/01-a/1-a1/1-camelcase/solution.md
Normal file
2
1-js/01-a/1-a1/1-camelcase/solution/index.js
Normal file
2
1-js/01-a/1-a1/1-camelcase/solution/index.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
console.log("Hello");
|
3
1-js/01-a/1-a1/1-camelcase/source/index.js
Normal file
3
1-js/01-a/1-a1/1-camelcase/source/index.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
function camelize(str) {
|
||||
/* your code */
|
||||
}
|
19
1-js/01-a/1-a1/1-camelcase/source/test.js
Normal file
19
1-js/01-a/1-a1/1-camelcase/source/test.js
Normal 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");
|
||||
});
|
||||
|
||||
});
|
20
1-js/01-a/1-a1/1-camelcase/task.md
Normal file
20
1-js/01-a/1-a1/1-camelcase/task.md
Normal 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.
|
0
1-js/01-a/1-a1/2-runjs/solution.md
Normal file
0
1-js/01-a/1-a1/2-runjs/solution.md
Normal file
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'
|
||||
}
|
1
1-js/01-a/1-a1/2-runjs/source/index.js
Normal file
1
1-js/01-a/1-a1/2-runjs/source/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
console.log("Test", "passed");
|
6
1-js/01-a/1-a1/2-runjs/source/test.js
Normal file
6
1-js/01-a/1-a1/2-runjs/source/test.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
describe("runjs", function() {
|
||||
|
||||
it("passes", function() { });
|
||||
it("fails", function() { throw new Error("FAIL") });
|
||||
|
||||
});
|
20
1-js/01-a/1-a1/2-runjs/task.md
Normal file
20
1-js/01-a/1-a1/2-runjs/task.md
Normal 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.
|
0
1-js/01-a/1-a1/3-errorjs/solution.md
Normal file
0
1-js/01-a/1-a1/3-errorjs/solution.md
Normal file
10
1-js/01-a/1-a1/3-errorjs/solution/index.js
Normal file
10
1-js/01-a/1-a1/3-errorjs/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'
|
||||
}
|
6
1-js/01-a/1-a1/3-errorjs/source/index.js
Normal file
6
1-js/01-a/1-a1/3-errorjs/source/index.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
function f() {
|
||||
throw new Error("ERR");
|
||||
}
|
||||
|
||||
f();
|
6
1-js/01-a/1-a1/3-errorjs/source/test.js
Normal file
6
1-js/01-a/1-a1/3-errorjs/source/test.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
describe("errorjs", function() {
|
||||
|
||||
it("passes", function() { });
|
||||
it("fails", function() { throw new Error("FAIL") });
|
||||
|
||||
});
|
20
1-js/01-a/1-a1/3-errorjs/task.md
Normal file
20
1-js/01-a/1-a1/3-errorjs/task.md
Normal 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.
|
0
1-js/01-a/1-a1/4-syntaxerrorjs/solution.md
Normal file
0
1-js/01-a/1-a1/4-syntaxerrorjs/solution.md
Normal file
10
1-js/01-a/1-a1/4-syntaxerrorjs/solution/index.js
Normal file
10
1-js/01-a/1-a1/4-syntaxerrorjs/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'
|
||||
}
|
7
1-js/01-a/1-a1/4-syntaxerrorjs/source/index.js
Normal file
7
1-js/01-a/1-a1/4-syntaxerrorjs/source/index.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
function f() {
|
||||
throw new Error("ERR");
|
||||
}
|
||||
|
||||
{{{
|
||||
|
||||
f();
|
6
1-js/01-a/1-a1/4-syntaxerrorjs/source/test.js
Normal file
6
1-js/01-a/1-a1/4-syntaxerrorjs/source/test.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
describe("errorjs", function() {
|
||||
|
||||
it("passes", function() { });
|
||||
it("fails", function() { throw new Error("FAIL") });
|
||||
|
||||
});
|
20
1-js/01-a/1-a1/4-syntaxerrorjs/task.md
Normal file
20
1-js/01-a/1-a1/4-syntaxerrorjs/task.md
Normal 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.
|
3
1-js/01-a/1-a1/article.md
Normal file
3
1-js/01-a/1-a1/article.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# An Introduction to JavaScript
|
||||
|
||||
Let's see what's so special about JavaScript, what we can achieve with it, and which other technologies play well with it.
|
Loading…
Add table
Add a link
Reference in a new issue