1.Given the following array, what is the value of test:
var school = [
['David', 'Yamil', 'Edgardo'],
['Mari', 'Jan', 'Luis', 'Nelson']
];
var test = school[1][2];
import cowsay from 'cowsay-browser' | |
export default () => ( | |
<pre>{ cowsay.say({ text: 'hi there!' }) }</pre> | |
) |
// pages/index.js | |
import Link from 'next/link' | |
export default () => ( | |
<div>Click <Link href="/about"><a>here</a></Link> to read more</div> | |
) | |
// pages/about.js | |
export default () => ( | |
<p>Welcome to About!</p> | |
) |
`# Our Schema allows these mutations | |
type Mutation { | |
# Update Food Truck Image | |
updateFoodTruckImage(foodTruckId: ID!, image:String ): FoodTruck | |
# Update Food Truck Logo | |
updateFoodTruckLogo(foodTruckId: ID!, logo:String ): FoodTruck | |
# Update Food Truck Name | |
updateFoodTruckName(foodTruckId: ID!, name:String ): FoodTruck | |
... | |
... and so on with each field! (I'm too lazy to keep doing this ;) |
`# Our Schema allows these mutations | |
type Mutation { | |
# Update Food Truck (omg only in one mutation?!) :p | |
updateFoodTruck(input: FoodTruckUpdateInput!): FoodTruck | |
} | |
# Defines the type of the input | |
input FoodTruckUpdateInput { | |
# Id of foodtruck to update | |
foodTruckId: ID! | |
# Photo of FoodTruck |
import mongoose, { Schema } from 'mongoose'; | |
export const FoodTruckSchema = new Schema({ | |
image: { | |
type: String, | |
}, | |
logo: { | |
type: String, | |
}, | |
name: { | |
type: String, |
// ... | |
FoodTruckSchema.statics.updateFoodTruck = updateFoodTruck; | |
function updateFoodTruck(input, currentUser) { | |
return new Promise((resolve, reject) => { | |
// Code Here | |
}); | |
} |
// This is bad | |
function updateFoodTruck(input, currentUser) { | |
return new Promise((resolve, reject) => { | |
// Code Here | |
let foodTruckId = input.foodTruckId; | |
let image = input.image; | |
... and so on :( | |
}); | |
} |
// This is Good | |
function updateFoodTruck({ foodTruckId, image, logo, name, takingOrders, available, location }, currentUser) { | |
return new Promise((resolve, reject) => { | |
// Code Here | |
}); | |
} |
FoodTrucks.updateFoodTruck({ name: 'Updated FoodTruck Name', foodTruckId: '1234' }); |