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
// triple the value of every element in a given array | |
const triple = (arr) => { | |
let results = [] | |
for (let i = 0; i < arr.length; i++){ | |
results.push(arr[i] * 3) | |
} | |
return results | |
} | |
// sum all the elements in a given array |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
const setCookie = (key,val,days_till_expiration) => { | |
let d = new Date(); | |
d.setTime(d.getTime() + (days_till_expiration*24*60*60*1000)); | |
const expires = "expires=" + d.toGMTString(); | |
document.cookie = key + "=" + val + ";" + expires + ";"; | |
} |
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
const getUserData = () => { | |
let username = fetchCookie(); | |
if (username != "") { | |
alert("Welcome again " + username); | |
} else { | |
username = prompt("Please enter your name:",""); | |
setCookie("username", username, 30); | |
} | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
document.cookie = "monster=cookie"; | |
document.cookie = "favorite_food=chocolate_chip"; | |
alert(document.cookie); | |
</script> | |
</head> | |
<body> |
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
const express = require('express') | |
const app = express() | |
app.get('/', (req,res) => { | |
res.sendFile(__dirname + "/index.html"); | |
}) | |
app.listen('8081') | |
console.log('Magic happens on port 8081') | |
exports = module.exports = app |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<h1>Cookies!</h1> | |
<button>Show cookies</button> | |
</body> | |
</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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Omer's Workshop</title> | |
<script src="https://unpkg.com/redux@latest/dist/redux.min.js"></script> | |
</head> | |
<body> | |
<div> | |
<p> | |
Counter: <span id="value">0</span> times |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Omer's Workshop</title> | |
<script src="https://unpkg.com/redux@latest/dist/redux.min.js"></script> | |
</head> | |
<body> | |
<div> | |
<p> | |
Counter: <span id="value">0</span> times |