Linked Questions

19 questions linked to/from Javascript Closures and 'this'
0 votes
1 answer
3k views

Explanation of code I have a function called placeDecode which takes an HTML input element. Within the function I have a promise which converts input value into a formatted address. I called ...
0 votes
3 answers
1k views

I used to use MyClass.prototype.myMethod1 = function(value) { this._current = this.getValue("key", function(value2){ return value2; }); }; How do I access the value of this within the ...
Alan Coromano's user avatar
0 votes
1 answer
90 views

I am building an app in JavaScript. I am trying to get my head around how to use this in a JavaScript closure. Currently, I have the following code: var ExternalResource = require('ExternalResource');...
JQuery Mobile's user avatar
-1 votes
1 answer
44 views

How come the following line: pop = setInterval(function () { doSlide($(this)) }, settings.timeoutSet); not sending the proper reference as the parameter. I would like to set up the same ...
Si8's user avatar
  • 9,255
0 votes
0 answers
47 views

I have an idea to create an object Shout, which should take keyboard messages onkeypress event from the input element. When the user presses a key, there should appear alert box with shout exclamation....
lyborko's user avatar
  • 2,629
1921 votes
16 answers
651k views

I have a constructor function which registers an event handler: function MyConstructor(data, transport) { this.data = data; transport.on('data', function () { alert(this.data); ...
20 votes
1 answer
24k views

What are closures and callbacks in JavaScript? I've yet to find a good explanation of either.
user avatar
4 votes
1 answer
5k views

Let's say I have a basic dumb javascript class : var FunctionX = function(configs) { this.funcConfigs = configs; } FunctionX.prototype.getData = function() { return $.get('/url'); } FunctionX....
Erick's user avatar
  • 6,119
3 votes
3 answers
4k views

I've seen a bunch of examples but can't seem to get some sample code to work. Take the following code: var test = (function(){ var t = "test"; return { alertT: function(){ ...
1 vote
1 answer
2k views

I have the following AngularJS controller: controllers.controller('QueuesCtrl', ['$scope', 'QueueRes',function($scope,QueueRes) { $scope.queues = QueueRes.query(); this.queue={}; this....
0 votes
1 answer
2k views

I have a HTML element bound to one of observables in my view model that is build with John Resig's simple javascript inheritance. <div data-bind="with: selectedItem()"> ... <div ...
S.N's user avatar
  • 409
1 vote
2 answers
376 views

I have a jsfiddle for this issue. https://jsfiddle.net/uvtw5kp1/4/ $scope.Dropdown = { open: false, searchValue: "", timer: null, hideIt: function() { this.timer = $timeout(function() ...
NetHawk's user avatar
  • 1,412
3 votes
4 answers
105 views

I have following code block in javascript: const obj = { name: "sri1", func1: function() { const name = "sri2" function a() { console.log(this.name) } a(); ...
sriram hegde's user avatar
  • 2,491
0 votes
1 answer
197 views

This code shows (i.e. alerts) "alert1" but not "alert2". I'm using a Samsung Galaxy Tab 3 7.0 as target device. The following code is in index.js. EDIT: "alert3" is neither shown - for those who get ...
0 votes
2 answers
63 views

I am user iron-list with iron-ajax but after ajax response when pushing element to iron-list giving null exception = "Cannot read property '_list' of undefined" <script> Polymer({ ...

15 30 50 per page
1
2