From 5a024624af7f5746f433f8279afd999a8ad50dab Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Sat, 23 Jan 2021 23:30:28 +0300 Subject: [PATCH] minor fixes --- .../03-variables/1-hello-variables/solution.md | 12 ------------ .../03-variables/1-hello-variables/solution/1.js | 1 + .../03-variables/1-hello-variables/solution/2.js | 3 +++ .../03-variables/1-hello-variables/solution/3.js | 5 +++++ .../03-variables/1-hello-variables/solution/4.js | 7 +++++++ .../03-variables/1-hello-variables/task.md | 10 ---------- .../03-variables/1-hello-variables/task/1.md | 4 ++++ .../03-variables/1-hello-variables/task/2.md | 1 + .../03-variables/1-hello-variables/task/3.md | 1 + .../03-variables/1-hello-variables/task/4.md | 1 + .../03-variables/1-hello-variables/test/1.js | 9 +++++++++ .../03-variables/1-hello-variables/test/2.js | 5 +++++ .../03-variables/1-hello-variables/test/3.js | 6 ++++++ .../03-variables/1-hello-variables/test/4.js | 14 ++++++++++++++ 14 files changed, 57 insertions(+), 22 deletions(-) delete mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/solution.md create mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/solution/1.js create mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/solution/2.js create mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/solution/3.js create mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/solution/4.js delete mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/task.md create mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/task/1.md create mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/task/2.md create mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/task/3.md create mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/task/4.md create mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/test/1.js create mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/test/2.js create mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/test/3.js create mode 100644 1-js/01-getting-started/03-variables/1-hello-variables/test/4.js diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/solution.md b/1-js/01-getting-started/03-variables/1-hello-variables/solution.md deleted file mode 100644 index 9249e1c8..00000000 --- a/1-js/01-getting-started/03-variables/1-hello-variables/solution.md +++ /dev/null @@ -1,12 +0,0 @@ -In the code below, each line corresponds to the item in the task list. - -```js run -let admin, name; // can declare two variables at once - -name = "John"; - -admin = name; - -alert( admin ); // "John" -``` - diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/solution/1.js b/1-js/01-getting-started/03-variables/1-hello-variables/solution/1.js new file mode 100644 index 00000000..c892e37b --- /dev/null +++ b/1-js/01-getting-started/03-variables/1-hello-variables/solution/1.js @@ -0,0 +1 @@ +let user, admin; \ No newline at end of file diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/solution/2.js b/1-js/01-getting-started/03-variables/1-hello-variables/solution/2.js new file mode 100644 index 00000000..8cff1cd4 --- /dev/null +++ b/1-js/01-getting-started/03-variables/1-hello-variables/solution/2.js @@ -0,0 +1,3 @@ +let user, admin; + +user = "John"; \ No newline at end of file diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/solution/3.js b/1-js/01-getting-started/03-variables/1-hello-variables/solution/3.js new file mode 100644 index 00000000..cf7d4bae --- /dev/null +++ b/1-js/01-getting-started/03-variables/1-hello-variables/solution/3.js @@ -0,0 +1,5 @@ +let user, admin; + +user = "John"; + +admin = user; \ No newline at end of file diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/solution/4.js b/1-js/01-getting-started/03-variables/1-hello-variables/solution/4.js new file mode 100644 index 00000000..4118406a --- /dev/null +++ b/1-js/01-getting-started/03-variables/1-hello-variables/solution/4.js @@ -0,0 +1,7 @@ +let user, admin; + +user = "John"; + +admin = user; + +alert(admin); \ No newline at end of file diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/task.md b/1-js/01-getting-started/03-variables/1-hello-variables/task.md deleted file mode 100644 index 84f009e8..00000000 --- a/1-js/01-getting-started/03-variables/1-hello-variables/task.md +++ /dev/null @@ -1,10 +0,0 @@ -importance: 2 - ---- - -# Working with variables - -1. Declare two variables: `admin` and `name`. -2. Assign the value `"John"` to `name`. -3. Copy the value from `name` to `admin`. -4. Show the value of `admin` using `alert` (must output "John"). diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/task/1.md b/1-js/01-getting-started/03-variables/1-hello-variables/task/1.md new file mode 100644 index 00000000..0cea46df --- /dev/null +++ b/1-js/01-getting-started/03-variables/1-hello-variables/task/1.md @@ -0,0 +1,4 @@ + +# Working with variables + +Declare two variables: `admin` and `user`. \ No newline at end of file diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/task/2.md b/1-js/01-getting-started/03-variables/1-hello-variables/task/2.md new file mode 100644 index 00000000..d91d060d --- /dev/null +++ b/1-js/01-getting-started/03-variables/1-hello-variables/task/2.md @@ -0,0 +1 @@ +Assign the value `"John"` to `user`. \ No newline at end of file diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/task/3.md b/1-js/01-getting-started/03-variables/1-hello-variables/task/3.md new file mode 100644 index 00000000..c109b895 --- /dev/null +++ b/1-js/01-getting-started/03-variables/1-hello-variables/task/3.md @@ -0,0 +1 @@ +Copy the value from `user` to `admin`. \ No newline at end of file diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/task/4.md b/1-js/01-getting-started/03-variables/1-hello-variables/task/4.md new file mode 100644 index 00000000..cc956804 --- /dev/null +++ b/1-js/01-getting-started/03-variables/1-hello-variables/task/4.md @@ -0,0 +1 @@ +Show the value of `admin` using `alert` (will show "John"). \ No newline at end of file diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/test/1.js b/1-js/01-getting-started/03-variables/1-hello-variables/test/1.js new file mode 100644 index 00000000..3fbbd472 --- /dev/null +++ b/1-js/01-getting-started/03-variables/1-hello-variables/test/1.js @@ -0,0 +1,9 @@ +describe("Test", function() { + it("declares `admin`", function() { + admin; // error if not declared + }); + + it("declares `user`", function() { + user; // error if not declared + }); +}); \ No newline at end of file diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/test/2.js b/1-js/01-getting-started/03-variables/1-hello-variables/test/2.js new file mode 100644 index 00000000..c5177236 --- /dev/null +++ b/1-js/01-getting-started/03-variables/1-hello-variables/test/2.js @@ -0,0 +1,5 @@ +describe("Test", function() { + it(`user equals "John"`, function() { + expect(user).toEqual("John"); + }); +}); \ No newline at end of file diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/test/3.js b/1-js/01-getting-started/03-variables/1-hello-variables/test/3.js new file mode 100644 index 00000000..1d6ec8d4 --- /dev/null +++ b/1-js/01-getting-started/03-variables/1-hello-variables/test/3.js @@ -0,0 +1,6 @@ +describe("Test", function() { + it(`user and admin equal "John"`, function() { + expect(user).toEqual("John"); + expect(admin).toEqual("John"); + }); +}); \ No newline at end of file diff --git a/1-js/01-getting-started/03-variables/1-hello-variables/test/4.js b/1-js/01-getting-started/03-variables/1-hello-variables/test/4.js new file mode 100644 index 00000000..c1ec1a80 --- /dev/null +++ b/1-js/01-getting-started/03-variables/1-hello-variables/test/4.js @@ -0,0 +1,14 @@ +let nativeAlert = globalThis.alert; +globalThis.alert = jasmine.createSpy(); + +describe("Test", function() { + + after(function() { + globalThis.alert = this.alert; + }); + + it(`user and admin equal "John"`, function() { + expect(user).toEqual("John"); + expect(admin).toEqual("John"); + }); +}); \ No newline at end of file