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
// memory.js contents | |
class MemoryGame { | |
constructor(cards) { | |
this.cards = cards; | |
this.pickedCards = []; | |
this.pairsClicked = 0; | |
this.pairsGuessed = 0; | |
} |
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
// ITERATION 1 | |
function updateSubtotal(product) { | |
console.log('Calculating subtotal, yey!'); | |
//... your code goes here | |
const priceElement = product.querySelector('.price span'); | |
const quantityElement = product.querySelector('.quantity input'); |
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
class Chronometer { | |
constructor() { | |
this.currentTime = 0; | |
this.intervalId = null; | |
} | |
start(callback) { | |
this.intervalId = setInterval(() => { | |
this.currentTime++; | |
if (callback) callback(); |
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
// Queue | |
class Queue { | |
constructor() { | |
this.queueControl = []; | |
this.MAX_SIZE = 10; | |
} | |
display() { | |
return this.queueControl; |
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(health, strength) { | |
this.health = health; | |
this.strength = strength; | |
} | |
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
import './App.css'; | |
import { BrowserRouter, Route } from 'react-router-dom'; | |
import CountryDetails from './components/CountryDetails'; | |
import Navbar from './components/Navbar'; | |
import CountryList from './components/CountryList'; | |
import countries from './countries.json'; | |
function App() { | |
return ( |
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 meals from './foods.json'; | |
class MealBox extends React.Component { | |
state = { | |
quantity: 1, | |
}; | |
handleQuantityChange = (event) => { |
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 Rating from './components/Rating'; | |
import FaceBook from './components/FaceBook'; | |
function DriverCard({ name, rating }) { | |
return ( | |
<div> | |
<h1>{name}</h1> | |
<Rating>{rating}</Rating> |
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(props) { | |
super(props); | |
this.state = { | |
contacts: contacts.slice(0, 5) | |
}; |