1
0
Fork 0

Video 56: ES6 Aside: Default Function Parameters

This commit is contained in:
Jason Williams 2019-10-10 11:56:26 -06:00
parent 040916eaa2
commit 4fc267d599
3 changed files with 9 additions and 2 deletions

View File

@ -29,7 +29,7 @@ const product = {
// console.log(stock)
// console.log(rating)
const transaction = (type, {label, stock}) => {
const transaction = (type, { label, stock = 0 } = {}) => {
console.log(type, label, stock)
}

View File

@ -0,0 +1,7 @@
const greeter = (name = 'user', age) => {
console.log('Hello ' + name)
}
greeter('Jason')
greeter()

View File

@ -48,7 +48,7 @@ app.get('/weather', (req, res) => {
})
}
geocode(req.query.address, (error, {latitude, longitude, location}) => {
geocode(req.query.address, (error, {latitude, longitude, location} = {}) => {
if (error) {
return res.send({ error: error })
}