Skip to content

Instantly share code, notes, and snippets.

View ManishPoduval's full-sized avatar
💭
I may be slow to respond.

Manish Poduval ManishPoduval

💭
I may be slow to respond.
View GitHub Profile
@ManishPoduval
ManishPoduval / recursive-practice.md
Created December 9, 2020 09:20
JavaScript Recursion

Assignment

Requirements

  • 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
// ***************************************************************
// 1: Capitalize each element of the array - the whole word:
// ***************************************************************
const fruits = ['pineapple', 'orange', 'mango'];
const capsFruits = fruits.map(oneFruit => {
return oneFruit.toUpperCase();
});
// TODO: write the methods getAge, addFriend and getRandomFriend
const chuck = {
firstName: 'Chuck',
lastName: 'Norris',
birthDate: new Date('1940-03-10'),
friends: [
'Alvaro',
'Luis'
],
<!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>
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;

Express-Handlebars setup

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

Steps

  • Install the package
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);
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))

Instructions

Our First Full Stack Project Setup

Ironlauncher installation

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)