This file contains 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
/* | |
* translates "turpentine and turtles" to "whale talk" languag, outputs "UUEEIEEAUUEE" | |
*/ | |
const input = 'turpentine and turtles'; | |
const vowels = ['a', 'e', 'i', 'o', 'u']; | |
const resultArray = []; | |
for(let i = 0; i < input.length; i++) { |
This file contains 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 express = require('express'); | |
const app = express(); | |
// Route handler | |
app.get('/users/:id', (req, res, next) => { | |
const userId = req.params.id; | |
// Simulating an error when user is not found | |
if (!getUserById(userId)) { | |
const error = new Error('User not found'); |
This file contains 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 express = require("express"); | |
const app = express(); | |
// Serves Express Yourself website | |
app.use(express.static("public")); | |
const { | |
getElementById, | |
getIndexById, | |
updateElement, |
This file contains 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 cities = [ | |
{ name: 'New York', lat: 40.7128, lng: -74.0060 }, | |
{ name: 'London', lat: 51.5074, lng: -0.1278 }, | |
{ name: 'Paris', lat: 48.8566, lng: 2.3522 }, | |
{ name: 'Tokyo', lat: 35.6895, lng: 139.6917 }, | |
{ name: 'Sydney', lat: -33.8651, lng: 151.2099 }, | |
{ name: 'Rome', lat: 41.9028, lng: 12.4964 }, | |
{ name: 'Cairo', lat: 30.0444, lng: 31.2357 }, | |
{ name: 'Rio de Janeiro', lat: -22.9068, lng: -43.1729 }, | |
{ name: 'Dubai', lat: 25.2048, lng: 55.2708 }, |
This file contains 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 axiosRequest = require('axios'); | |
axiosRequest | |
.get('http://www.boredapi.com/api/activity/') | |
.then(response => { | |
console.log(`You could ${response.data.activity}`); | |
}) | |
.catch(error => { | |
console.error(`ERROR! ${error}`); | |
}); |
This file contains 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
// Use a variable to set the `height` and `width` attributes: | |
const sideLength = "200px"; | |
const panda = ( | |
<img | |
src="images/panda.jpg" | |
alt="panda" | |
height={sideLength} | |
width={sideLength} /> |
This file contains 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 readline = require('readline'); | |
const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); | |
const contacts = []; | |
function addContact() { | |
rl.question('Enter name: ', (name) => { | |
rl.question('Enter phone #: ', (phoneNumber) => { | |
contacts.push({ name, phoneNumber }); |
This file contains 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
.DS_Store | |
._* | |
Icon | |
.Spotlight-V100 | |
.Trashes | |
.LSOverride | |
.fseventsd | |
.TemporaryItems | |
.localized | |
*.cache |
This file contains 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
*.DS_Store | |
*.idea | |
*.[Cc]ache | |
*.log | |
*.log.* | |
[Oo]bj | |
[Bb]in | |
ErrorLogs | |
*~ | |
*.db |