- You must use recursion to solve these problems.
- It's possible to solve them non-recursively and you'll probably be tempted to use tools that you already understand. However, that defeats the purpose of this exercise, which is to become more comfortable using
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
// *************************************************************** | |
// 1: Capitalize each element of the array - the whole word: | |
// *************************************************************** | |
const fruits = ['pineapple', 'orange', 'mango']; | |
const capsFruits = fruits.map(oneFruit => { | |
return oneFruit.toUpperCase(); | |
}); |
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
// TODO: write the methods getAge, addFriend and getRandomFriend | |
const chuck = { | |
firstName: 'Chuck', | |
lastName: 'Norris', | |
birthDate: new Date('1940-03-10'), | |
friends: [ | |
'Alvaro', | |
'Luis' | |
], |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>DOM - manipulation</title> | |
</head> | |
<body> | |
<!-- part 1 --> | |
<h1>To Do List</h1> |
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
console.log('INDEX.JS connected'); | |
// ****************************** part 1 ********************************* | |
function mySubmitEventListener(){ | |
let myForm = document.querySelector('#new-task-form') | |
myForm.addEventListener('submit', e => { | |
e.preventDefault(); | |
const taskInput = document.querySelector('#task-input'); | |
const taskContent = taskInput.value; |
We will use this package Ironlauncher to setup our code like we did the past week.
Note: Mac Installation is also the same as Windows. If you get erros don't panic. Relax, read the error, search online for a fix. Read the last part of this document for possible errors and fixes
- Install the package
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 anagrams = function(word){ | |
var anagramResult = []; | |
// Base case, word has 1 character. | |
if (word.length === 1) return [word]; | |
// Else, go through every letter of the word | |
for (var i = 0; i < word.length; i++) { | |
var restOfWord = word.substring(0, i) + word.substring(i + 1); | |
var results = anagrams(restOfWord); |
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, { Component, useState } from 'react' | |
import studentsJson from '../students.json' | |
import StudentDetails from './StudentDetails' | |
function Students() { | |
const [students, updateStudents] = useState(studentsJson.slice(0,5)) | |
We will use Ironlauncher package that we used in module2 to set up our full-stack project code template. But this time we'll use to set up our client side code as well.
(Note: create-react-app
is inbuilt in this package)