Skip to content

Instantly share code, notes, and snippets.

View Ifycode's full-sized avatar
🎯
Always in Collabo mode 🤝

Mary @Ifycode Ifycode

🎯
Always in Collabo mode 🤝
View GitHub Profile
@Ifycode
Ifycode / index.html
Last active July 31, 2020 21:39
Embed for Understanding Regular Function & Converting To Arrow Function Article HTML file example
<!DOCTYPE html>
<html>
<head></head>
<body id="container">
<div id="displayBlock"></div>
<script src="index.js"></script>
</body>
</html>
@Ifycode
Ifycode / index.js
Last active July 31, 2020 21:43
Embed for Understanding Regular Function & Converting To Arrow Function Article index.js file - Js example 1
'use strict';
//Named function
function sameFunction() {
let displayBox = document.getElementById('displayBox');
let num3 = 3;
let num4 = 4;
displayBox.innerHTML = `${num3} + ${num4} = ${num3+num4}`;
}
@Ifycode
Ifycode / index.js
Created July 31, 2020 21:46
Embed for Understanding Regular Function & Converting To Arrow Function Article index.js file - Js example 2
'use strict';
//Anonymous function stored in a variable
let sameFunction = function () {
let displayBox = document.getElementById('displayBox');
let num3 = 3;
let num4 = 4;
displayBox.innerHTML = `${num3} + ${num4} = ${num3+num4}`;
}
@Ifycode
Ifycode / index.js
Created July 31, 2020 21:53
Embed for Understanding Regular Function & Converting To Arrow Function Article index.js file - Js example 3
'use strict';
//Named function with parameters
function sameFunction(num3, num4) {
let displayBox = document.getElementById('displayBox');
displayBox.innerHTML = `${num3} + ${num4} = ${num3+num4}`;
}
sameFunction(3, 4);
//output: 3 + 4 = 7
@Ifycode
Ifycode / index.js
Created July 31, 2020 21:59
Embed for Understanding Regular Function & Converting To Arrow Function Article index.js file - Js example 4
'use strict';
//Anonymous function with parameters
let sameFunction = function(num3, num4) {
let displayBox = document.getElementById('displayBox');
displayBox.innerHTML = `${num3} + ${num4} = ${num3+num4}`;
}
sameFunction(3, 4);
//output: 3 + 4 = 7
@Ifycode
Ifycode / index.js
Created July 31, 2020 22:04
Embed for Understanding Regular Function & Converting To Arrow Function Article index.js file - Js example 5
'use strict';
//arrow function
let sameFunction = () => {
let displayBox = document.getElementById('displayBox');
let num3 = 3;
let num4 = 4;
displayBox.innerHTML = `${num3} + ${num4} = ${num3+num4}`;
}
@Ifycode
Ifycode / index.js
Created July 31, 2020 22:09
Embed for Understanding Regular Function & Converting To Arrow Function Article index.js file - Js example 6
'use strict';
//arrow function with parameters
let sameFunction = (num3, num4) => {
let displayBox = document.getElementById('displayBox');
displayBox.innerHTML = `${num3} + ${num4} = ${num3+num4}`;
}
sameFunction(3, 4);
//output: 3 + 4 = 7
@Ifycode
Ifycode / index.js
Last active August 1, 2020 02:16
Embed for Understanding Regular Function & Converting To Arrow Function Article index.js file - Js example 7
'use strict';
function changeBackground(color) {
let container = document.getElementById('container');
container.style.backgroundColor = color;
}
let redBtn = document.getElementById('redBtn');
redBtn.onclick = function () {
changeBackground('red');
@Ifycode
Ifycode / index.html
Last active August 1, 2020 02:21
Embed for Understanding Regular Function & Converting To Arrow Function Article HTML file example modified
<!DOCTYPE html>
<html>
<head></head>
<body id="container">
<!--
<div id="displayBlock"></div>
-->
<button id="redBtn">Red</button>
<button id="blueBtn">Blue</button>
<button id="yellowBtn">Yellow</button>