//DESTRUCTURING ARRAYS AND OBJECTS
const food = ['rice','beans','plantain','oks']
const[bestfood,davidbest,mamabest] = food
console.log(bestfood)
//DESTRUCTURING OBJECTS
const loctechstudents = {
name:"sunday",
age:23,
phone:08168858170,
gender:"male",
isundergraduate:true
}
const newAge = 45
const{name,newAge:age} = loctechstudents
console.log(newAge)
//DEFAULT PARAMETER
function add(y,x=30){
return y+x
}
//SPRREAD
//spread is not a call back function , but a syntax in modern javascript that helps
us to spread iterable element such as array and string
//it can help us spred strings
console.log(...'joseph is a programmer')
console.log('joseph')
///how spread works with array
//spread can help us concatenate arrays
const cars = ['rover','toyota','bmw']
const newcars = ['ford','tesla','benz']
const allcars = [...cars,...newcars]
console.log(cars.concat(newcars))
console.log(allcars)
//it can also help spread objects in array , mostly used in node.js with embedded
javascript
//REST
function occasion (chairman,mother,...others){
console.log(`you are too much ${chairman},our lovely mother${mother} thsnk
you, and to ${others} thanks for coming`)
}