minor fixes
This commit is contained in:
parent
51edbb1236
commit
5a024624af
14 changed files with 57 additions and 22 deletions
|
@ -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"
|
||||
```
|
||||
|
|
@ -0,0 +1 @@
|
|||
let user, admin;
|
|
@ -0,0 +1,3 @@
|
|||
let user, admin;
|
||||
|
||||
user = "John";
|
|
@ -0,0 +1,5 @@
|
|||
let user, admin;
|
||||
|
||||
user = "John";
|
||||
|
||||
admin = user;
|
|
@ -0,0 +1,7 @@
|
|||
let user, admin;
|
||||
|
||||
user = "John";
|
||||
|
||||
admin = user;
|
||||
|
||||
alert(admin);
|
|
@ -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").
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
# Working with variables
|
||||
|
||||
Declare two variables: `admin` and `user`.
|
|
@ -0,0 +1 @@
|
|||
Assign the value `"John"` to `user`.
|
|
@ -0,0 +1 @@
|
|||
Copy the value from `user` to `admin`.
|
|
@ -0,0 +1 @@
|
|||
Show the value of `admin` using `alert` (will show "John").
|
|
@ -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
|
||||
});
|
||||
});
|
|
@ -0,0 +1,5 @@
|
|||
describe("Test", function() {
|
||||
it(`user equals "John"`, function() {
|
||||
expect(user).toEqual("John");
|
||||
});
|
||||
});
|
|
@ -0,0 +1,6 @@
|
|||
describe("Test", function() {
|
||||
it(`user and admin equal "John"`, function() {
|
||||
expect(user).toEqual("John");
|
||||
expect(admin).toEqual("John");
|
||||
});
|
||||
});
|
|
@ -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");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue