Given
options = {
underscored: true
}
products = {
foo: bar
}
I’d like to get
products = {
underscored: true
foo: bar
}
Is it possible to push an object into another object in Javascript?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
ES5
ES6 – this will mutate objectToMergeTo
ES7 (syntax beauty with spread operator) –
this version however creates a new instance, you can’t add into an object with spread operator.