Skip to content

Instantly share code, notes, and snippets.

@ChrisMissal
Created September 28, 2012 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrisMissal/3797197 to your computer and use it in GitHub Desktop.
Save ChrisMissal/3797197 to your computer and use it in GitHub Desktop.
Extending objects in Dojo
var start = {
id: 123,
count: 41,
desc: 'this is information',
title: 'Base Object',
tag: 'uncategorized',
values: [1,1,2,3,5,8,13]
};
var more = {
name: 'Los Techies',
tag: 'javascript'
};
var extra = {
count: 42,
title: null,
desc: undefined,
values: [1,3,6,10],
dojo: true
};
var extended = dojo.mixin(extra, more, start);
console.log(JSON.stringify(extended));​
{
"count": 41,
"title": "Base Object",
"desc": "this is information",
"values": [1,1,2,3,5,8,13],
"dojo": true,
"name": "Los Techies",
"tag": "uncategorized",
"id": 123
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment