forked from mdn/learning-area
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
148 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
let name = 'Chris'; | ||
const name = 'Chris'; | ||
function greeting() { | ||
alert('Hello ' + name + ': welcome to our company.'); | ||
alert(`Hello ${name}: welcome to our company.`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
let name = 'Zaptec'; | ||
|
||
const name = 'Zaptec'; | ||
function greeting() { | ||
alert('Our company is called ' + name + '.'); | ||
alert(`Our company is called ${name}.`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
javascript/building-blocks/tasks/functions/functions4-download.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<title>Functions: Task 3</title> | ||
<style> | ||
p { | ||
color: purple; | ||
margin: 0.5em 0; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
} | ||
</style> | ||
<link rel="stylesheet" href="../styles.css" /> | ||
</head> | ||
|
||
<body> | ||
|
||
<section class="preview"> | ||
|
||
|
||
|
||
</section> | ||
|
||
</body> | ||
<script> | ||
const names = ['Chris', 'Li Kang', 'Anne', 'Francesca', 'Mustafa', 'Tina', 'Bert', 'Jada']; | ||
const para = document.createElement('p'); | ||
|
||
function isShort(name) { | ||
return name.length < 5; | ||
} | ||
|
||
const shortNames = names.filter(name => name.length < 5); | ||
para.textContent = shortNames; | ||
|
||
// Don't edit the code below here! | ||
|
||
const section = document.querySelector('section'); | ||
|
||
section.appendChild(para); | ||
</script> | ||
|
||
</html> |
50 changes: 50 additions & 0 deletions
50
javascript/building-blocks/tasks/functions/functions4.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Functions: Task 3</title> | ||
<link rel="stylesheet" href="../styles.css" /> | ||
<style> | ||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
p { | ||
color: purple; | ||
margin: 0.5em 0; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<section class="preview"> | ||
|
||
|
||
|
||
</section> | ||
|
||
<textarea class="playable playable-js" style="height: 220px;"> | ||
const names = ['Chris', 'Li Kang', 'Anne', 'Francesca', 'Mustafa', 'Tina', 'Bert', 'Jada']; | ||
const para = document.createElement('p'); | ||
|
||
function isShort(name) { | ||
return name.length < 5; | ||
} | ||
|
||
const shortNames = names.filter(isShort); | ||
para.textContent = shortNames; | ||
|
||
// Don't edit the code below here! | ||
|
||
section.innerHTML = ' '; | ||
|
||
section.appendChild(para); | ||
</textarea> | ||
|
||
<div class="playable-buttons"> | ||
<input id="reset" type="button" value="Reset" /> | ||
</div> | ||
</body> | ||
<script class="editable"></script> | ||
<script src="../playable.js"></script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters