[Pkg-javascript-commits] [backbone] 161/211: add a warning about pass by reference. Issue #356
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 17:00:18 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.5.0
in repository backbone.
commit d8d94f1391b3c8007a200c1e7cdc3625cf5ad300
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date: Thu May 26 14:25:56 2011 -0400
add a warning about pass by reference. Issue #356
---
index.html | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/index.html b/index.html
index cb73e20..5696634 100644
--- a/index.html
+++ b/index.html
@@ -697,6 +697,11 @@ var Meal = Backbone.Model.extend({
alert("Dessert will be " + (new Meal).get('dessert'));
</pre>
+ <p class="warning">
+ Remember that in JavaScript, objects are passed by reference, so if you
+ include an object as a default value, it will be shared among all instances.
+ </p>
+
<p id="Model-toJSON">
<b class="header">toJSON</b><code>model.toJSON()</code>
<br />
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git
More information about the Pkg-javascript-commits
mailing list