DEV Community


Discussion on: Extract Functions Arguments using Destructure in JavaScript

samanthaming profile image
Samantha Ming Author

Thanks Manolo! And glad you found it helpful!

Totally, passing object is super cool! which kinda acts like named parameters where you don't have to worry about the order. I believe this is what you're referring to:

// Boo, arguments must be in specific order
function meal(protein, carb, veggie){
meal('🥩', '🍚', '🥦')

// Yay, arguments can be in any order
function meal2({protein, carb, veggie}){
meal2({carb: '🍚', veggie: '🥦', protein: '🥩'})

I have a tidbit on it as well > 😊

nombrekeff profile image

Yup that was exactly it :) I'll check it out