Ok, here's a problem script.
var links = [ 'one', 'two', 'three' ]; for( var i = 0; i < links.length; i++ ) { var a = document.createElement( 'div' ); ...
I have the following simple script.
<script> SPC = { a : [10], b : 10, t: function() { ...
I was reviewing some today, when I encountered the following convention :
TestParam(1); function TestParam(p){ var p = p + 1; alert(p); // alerts '2' }
I would like to know memory leak in the below mentioned code. Does JavaScript do automatic garbage collection.
var aGlobalObject = SomeGlobalObject; function myFunction() { var localVar = aGlobalObject; }
Example:
var o = {}; for(var i = 0; i < 5; i++) { o[i] = function () { console.log(i); }; } o[3]();
window.global_array = new Array(); window.example = function() { var x = new Object(); x['test_property'] = 3; ...
My problem is simple I think, but I couldn't find a simple solution to it. Here is the example:
var obj1 = { m1:"a", m2:"b" }; var ...