Last active
October 10, 2018 06:01
-
-
Save jyotiarora2610/58a6d5c9c6811d842ab8346299e05b53 to your computer and use it in GitHub Desktop.
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
// for single object | |
function testFunction(a, b, c, d, {name, company, isUsingLaptop}) { | |
console.log(a, b, c, d) | |
console.log(name, company, isUsingLaptop) | |
} | |
var a = 10 | |
var b = 20 | |
var c = true | |
var d = false | |
var defaultObj = { | |
name: 'jyoti', | |
company: 'olx', | |
isUsingLaptop: true | |
} | |
testFunction (a, b, c, d, defaultObj); | |
// for multi level objects | |
function testFunction(a, b, c, d, {name, companyDetails: {compantName}, isUsingLaptop}) { | |
console.log(a, b, c, d) | |
console.log(name, compantName, isUsingLaptop) | |
} | |
var a = 10 | |
var b = 20 | |
var c = true | |
var d = false | |
var defaultObj = { | |
name: 'jyoti', | |
companyDetails: { | |
compantName: 'olx', | |
department: 'tech' | |
}, | |
isUsingLaptop: true | |
} | |
testFunction (a, b, c, d, defaultObj); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment