This file contains hidden or 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
// ITERATION 1 | |
// Suspects Collection | |
const suspectsArray = [ | |
{ | |
firstName: 'Jacob', | |
lastName: 'Green', | |
occupation: 'Entrepreneur', | |
age: 45, |
This file contains hidden or 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
/* eslint no-restricted-globals: 'off' */ | |
// Iteration 1: All directors? - Get the array of all directors. | |
// _Bonus_: It seems some of the directors had directed multiple movies so they will pop up multiple times in the array of directors. How could you "clean" a bit this array and make it unified (without duplicates)? | |
const getAllDirectors = (movies) => { | |
return movies.map((movie) => movie.director); | |
}; | |
// Iteration 2: Steven Spielberg. The best? - How many drama movies did STEVEN SPIELBERG direct? |
This file contains hidden or 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
// Soldier | |
class Soldier { | |
constructor(a, b) { | |
this.health = a; | |
this.strength = b; | |
} | |
attack() { | |
return this.strength; | |
} |
This file contains hidden or 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
// main.js | |
const canvas = document.querySelector('canvas'); | |
const context = canvas.getContext('2d'); | |
// Useful Calculations | |
const width = canvas.width; | |
const height = canvas.height; | |
const tileCount = 10; |
This file contains hidden or 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
// Iteration 1 | |
const hacker1 = 'José'; | |
console.log("The driver's name is " + hacker1); | |
console.log('The driver\'s name is ' + hacker1); | |
console.log(`The driver's name is ${ hacker1 }`); // Template literal syntax, Backticks | |
const hacker2 = 'Gonçalo'; |
This file contains hidden or 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
/* eslint no-restricted-globals: 'off' */ | |
// Iteration 1: All directors? - Get the array of all directors. | |
// _Bonus_: It seems some of the directors had directed multiple movies so they will pop up multiple times in the array of directors. How could you "clean" a bit this array and make it unified (without duplicates)? | |
const getAllDirectors = (movies) => { | |
return movies.map((movie) => movie.director); | |
}; | |
// Iteration 2: Steven Spielberg. The best? - How many drama movies did STEVEN SPIELBERG direct? |
This file contains hidden or 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 category = 'Entertainment'; | |
// const image = `/images/${category.toLowerCase()}.jpeg`; | |
let image; | |
switch (category) { | |
case 'Travel': | |
image = '/images/travel.jpeg'; | |
break; |
This file contains hidden or 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
import React from 'react'; | |
import './App.css'; | |
import contacts from './contacts.json'; | |
class App extends React.Component { | |
constructor() { | |
super(); | |
this.state = { | |
list: contacts.slice(0, 5), | |
}; |
This file contains hidden or 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
// Iteration #1: Find the maximum | |
function maxOfTwoNumbers(a, b) { | |
if (a > b) { | |
return a; | |
} else { | |
return b; | |
} | |
} | |
// Iteration #2: Find longest word |
This file contains hidden or 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
// ITERATION 1 | |
// Suspects Collection | |
const suspectsArray = [ | |
{ | |
firstName: 'Jacob', | |
lastName: 'Green', | |
occupation: 'Entrepreneur', | |
age: 45, | |
description: 'He has a lot of connections', |