Last active
November 16, 2022 07:45
-
-
Save gabrielheinrich/2baa7c757bc6bab2e0bf07384b1cc917 to your computer and use it in GitHub Desktop.
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
// 1. Try to name all eight Javascript types | |
// 2. Which of these statements are true | |
0 == "0"; | |
0 === "0"; | |
null == undefined; | |
false == "false"; | |
[] == ""; | |
"" == false; | |
NaN == NaN; | |
({ a: 1 } == { a: 1 }); | |
({} === {}); | |
0.1 + 0.2 == 0.3; | |
0.2 + 0.2 == 0.4; | |
typeof [] == "array"; | |
typeof {} == "object"; | |
typeof console.log == "function"; | |
typeof typeof 0 == "number"; | |
// 3. Fill in the blank | |
["a", "b", "c", "d", "e", "f"].slice(/*???*/); // [c', 'd', 'e'] | |
[1, 2, 3].map(/*???*/); // [2, 4, 6] | |
["Apfel", "Birne", "Aprikose", "Karotte", "Ananas"].filter(/*???*/); // ['Apfel', 'Aprikose', 'Ananans'] | |
["A", "B", "B", "A"].reduce(/***/); // 'A-B-B-A' | |
["a", "b", "c", "d", "e"].sort(/***/); // ['e', 'd', 'c', 'b', 'a'] | |
// 4. Name an example of a constructor function that's built into Javascript | |
// 5. What's the difference between an arrow function and a traditional function expression? | |
// 6. What's the difference between these two functions A and B? | |
async function A() { | |
return "Hello"; | |
} | |
function B() { | |
return new Promise((resolve) => resolve("Hello")); | |
} | |
// 7. Which of these attributes/features are a part of Javascript (in its current widely used implementations) | |
/* | |
- Statically Typed | |
- Single Threaded | |
- Purely Functional | |
- Event-Based Concurrency | |
- Just in Time Compiled | |
- Ahead of Time Compiled | |
- Parallelisable | |
- Non Blocking I/O | |
- Imperative | |
- Object-oriented | |
- Multiple-inheritance | |
- Dynamic Scoping | |
- Lexical Scoping | |
- First Class Modules | |
- Garbage Collected | |
- Memory Safe | |
- Thread Safe | |
- Implicit Type Coercion | |
- Operator Overloading | |
- Dynamic | |
- Functional | |
*/ | |
// 8. Use the fetch API to download a random joke from https://official-joke-api.appspot.com/random_joke | |
// Hint: paste the snippet into the console of your browser instead of node | |
// 9. How could you import all four functions | |
// math.js | |
const add = (a, b) => a + b | |
export { add }; | |
export function mul(a, b) { return a * b; } | |
export const sub = (a, b) => a - b; | |
export default function div(a, b) { return a / b; } | |
// index.js | |
// import ??? from './math' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment