import React from 'react';
import './navigation-bar.css';
// The NavigationBar component goes here. It should be the default export.
export default function NavigationBar(props) {
'use strict'; | |
// // Get all | |
// db.restaurants.find().pretty(); | |
// // Limit and sort | |
// db.restaurants.find(). | |
// sort( {name: 1} ). |
-- 1 Get all restaurants | |
SELECT * FROM restaurants; | |
-- 2 Get Italian restaurants | |
SELECT * FROM restaurants | |
WHERE cuisine = 'Italian'; | |
-- 3 Get 10 Italian restaurants, subset of fields | |
SELECT id, name FROM restaurants | |
WHERE cuisine = 'Italian' |
- Split the text input into an array of strings broken down to each individual word.
- Create an object to store the usage count of each word.
- Loop through the array of words, adding words to the above object and updating usage counts as needed.
- Create temp variables to hold the word and usage count of the most frequent word and corresponding usage count with initial values from the first item in the object.
- Loop through each pair from the object and update the value of the temp variables when a new most frequent word is found.
- When the loop completes, return the resultant word from the temp variable.
Thinkful Web Development Fundamentals
Unit 2, Lesson 6, Project 5
Thinkful Web Development Fundamentals
Unit 2, Lesson 6, Project 2
Scope is the set of rules governing where a variable is valid based on the location of its definition.
Scope can be Global or Local. Any variable defined outside a function (or without the use of let
or const
)has a global scope and is accessible from anywhere in the program. A variable defined inside a function has a local scope and is only accessible from the context in which it was defined or blocks/functions nested within that context. This concept of nesting scope is referred to as the Scope Chain. Local scope will over-ride global scope. So, a variable defined with local scope can have the same name as a variable with global scope, but the program will treat them as separate variables. The value contained in the variable can't rise above where it was defined in the scope chain. Once the program rises out of the local scope, the code will look for a definition in the new scope and will keep looking in progressively higher parent scopes until it finds one. If the code
Thinkful Web Development Fundamentals
Unit 2, Lesson 4, Project 6
Thinkful Web Development Fundamentals
Unit 2, Lesson 4, Project 4
Thinkful Web Development Fundamentals
Unit 2, Lesson 4, Project 2