Use this tag for questions related to and particular to javascript-objects.

learn more… | top users | synonyms (1)

0
votes
1answer
25 views

Javascript: Parse array like search querystring

This is a string i have in my javascript var searchString = ...
0
votes
2answers
49 views

Converting json array into variable names/ values from nested form data to repopulate form

Hopefully I can explain this properly. I have a form that gets converted to nested json from grouped form elements such as <input type="checkbox" name="faults[slats][]" value="cracked"/> ...
0
votes
2answers
31 views

JavaScript: assignment to an object within an array changes the value of all objects in the array

I have an object which have an array to hold all the children of this object, the children are also instances of the same object (I need this for a tree like structure where the object is a node of ...
0
votes
7answers
47 views

Adding php loop data to js array

I have a php loop that loops through products and their data: <?php foreach ($this->products as $product) { ?> <script type=text/javascript> product = { id: ...
0
votes
3answers
18 views

When I initialize an array with an object in JavaScript, does the array contain a reference to the object or is it passed by value?

I am using JavaScript. I have an object. I then place that object inside an array that I initialize. I then do some work on that array and the value(s) inside it. I'm hoping to know if, by changing ...
1
vote
1answer
17 views

Understanding [options] argument in Backbone.sync method

I'm working on BackboneJS project and I need to override Backbone.sync I was looking for code example and I found this. Backbone.sync = function(method, model, options) { options || (options = ...
1
vote
2answers
16 views

create a map out of list of objects using a key found in the object

Essentially I have an object like so - var data= [ { id: 1, objectType: 'Workstation', isUp: true }, { id: 2, objectType: 'Workstation', isUp: true }, { ...
0
votes
3answers
30 views

javascript object literal, combining values of objects within same literal

I am trying to create a new object from looping through the below and combining values of objects that have like types? so I have something like this: var data = [{ transID: 123, ...
0
votes
1answer
21 views

Selecting Properties from Objects 2 layers down in an array

So here's what I am working with: var Data = [Obj, Obj, Obj] var Obj = { string1: 'string', string2: 'another string', string3: 'different string', object: { prop1: 'property', ...
2
votes
1answer
30 views

accessing javascript object from function

Why does first work and not the latter?? *its only a minor difference where in the latter case i used the shorthand for accessing cats object property. I read that it shouldn't make any difference if ...
0
votes
1answer
40 views

JS object toString() returns constructor.name and data which I cannot retrieve in any other way

My question is Adobe JS specific but I am almost sure its relevance is more general. To begin, please consider the particular case: Adobe JS API for 3D has an object called Matrix4x4. In the API ...
0
votes
1answer
15 views

Accessing a function define within a function from outside

I have some code whose structure I cannot change. And functions defined in such a manner. var Something.someFunc = function(e){ function funcTwo(){ } ... ... ... ... } I ...
0
votes
1answer
32 views

javascript prototype constructor and instanceof

When I checked instanceof method, the results are not same . function A(){} function B(){}; First I assigned prototype ( reference ) property , into A A.prototype = B.prototype; var carA = new ...
0
votes
1answer
28 views

How to assign a value of variable as name of an object in javascript

I pass a string through "objName". I want this to to be stored in the line: facebookData.objName For example: if I invoke the function like, fetchData(0, response, "friendsCount"), the object ...
0
votes
2answers
36 views

Adding Attributes to JS Object Literal with a Function

I am trying to add an "attribute" : "value", to my JS Object using a function, but am having trouble. I'm hoping some of you might be able to help. Allow me to create a context... Here is my object ...
0
votes
0answers
49 views

Programmatically Adding Attributes to JS Object

My post title is deceivingly simple, I think, because the specific question that I have is a bit tricky. I need to add an attribute to a Javascript object. The attribute is a date and has to be in ...
0
votes
0answers
39 views

Javascript's Object has different data at a time

for(var i=0; i<Elements.length; i++) { if( Elements[i].y < 0 ) { console.log({y:Elements[i].y, E:Elements[i]}); } } ========================================================== ...
0
votes
3answers
47 views

JavaScript global callback functions are not called?

I'm building a small web app with a few other people. I want to allow the other developers to define a couple of functions that are always called when the document is ready. Our app inserts the ...
0
votes
2answers
29 views

Addition of Properties within Object Literal produces NaN

Could someone help me undertand why I am getting NaN when adding two properties of an object literal together as the definition of a third property? Here's a code example, and I created a Codepen ...
2
votes
0answers
70 views

error with google swiffy calling runtime.js multiple times in the same page

I have converted multiple swf files using google swiffy v5.2 and will have my new animations displayed on many different pages, most of which I do not have control of or access to. In order for the ...
1
vote
0answers
23 views

JQuery grep - returning data with 2 parameters

So I have an array of objects, many of which have duplicate key properties, since some are dynamically created replications with a few, non-specific fields subject to change. var myArray = [ {Name: ...
-3
votes
0answers
37 views

Explain how this for loop works with objects [closed]

I found this project on the internet which makes a game of Chutes and Latters. Here are the directions: function createBoardCode() { // This method creates and returns an array of objects ...
0
votes
0answers
53 views

javascript replacing an object with an object

I have a javascript object that looks like this (don't judge me). {88:{1:{nTextID:179,bPublished:1}}, 89:{1:{nTextID:22,bPublished:1}, 2:{nTextID:22,bPublished:1} } }; at some point in my ...
-1
votes
1answer
86 views

JavaScript - Add Objects to Object and Remove via Key/Value Pair [closed]

I'm trying to finish a JS script where the objective is to add & remove first names & last names from an object. It's going to be transferred via AJAX to a PHP script which will then ...
0
votes
2answers
32 views

Multiple Values for Single Javascript Object Property

I have a javascript object which is built dynamically in a loop. I'd like to replace properties that might already exist with newer ones during the iteration- basically treating the object like a ...
5
votes
2answers
63 views

3 different types of JavaScript objects, what is the difference?

I've been deep diving into JavaScript lately and stumbled upon a question. What is the difference between the following implementations of a object: var myFunction1 = (function myFunction1() {})(); ...
0
votes
1answer
40 views

How to access global variable in function hook in javascript?

I want to use global variable 'x' in the below hook funcion. var x = 10; //global variable var oldA = a; a = function a(param){ alert(x); //showing error: x is undefined ...
0
votes
1answer
16 views

Javascript: Calling object property says the object(declared with object literal) is undefined

html: <div class="odf_details" id="con_details_nttn_odf_details"> <span class="hidden_id">con_details_nttn_odf_details</span> <span ...
1
vote
2answers
41 views

Acessing javaScript array of objects like a matrix

Is it possible to make access to a property of an object into an array of objects like a matrix? I mean something like this: jSon generated object: [ { "Nome": "1", ...
0
votes
2answers
58 views

Merging two backbone collection and models into one object using underscore

I have two backbone collections Categories and Items, Categories contains category models with id, name, and items (w/c contains item ids in string format separated by commas) and Items collection ...
0
votes
1answer
11 views

javascript: when declaring a prototype method: error is invalid left hand side for assignment

I am new to object oriented javascript. Trying to make an object constructor. Here is my code function Collection() { this.ports = build_ports_collection(); this.all_things = ...
1
vote
3answers
33 views

Javascript objects: Is there any difference between setting an objects property from inside a function or by its return value

Setting a property named 'sample' to 1 : Way 1: function Collection() { this.sample = function() { return 1; } } Way 2: function Collection() { this.sample = function() { ...
2
votes
1answer
31 views

How do you extract/where the javascript list with an array property

I like to extract the javascript object list using underscore.js where The original json list [{"id":1},{"id":2},{"id":3},{"id":4},{"id":5},{"id":6}] And the array to filter out: ...
0
votes
1answer
113 views

AngularJS - filtering Javascript Map

I've been trying to implement filtering JS Map Object (array indexed by an id) instead of the usual js array in angularJS. For illustration, below is a slight modification of the filtering example as ...
0
votes
2answers
65 views

Setting JavaScript “class” properties from internal function using “this” Keyword?

I am surprised that I could not find more on this topic (could be my sub-par search skills). Typically once I think I understand how the JavaScript keyword, "this" works it then stops working the way ...
0
votes
2answers
51 views

Backbonejs - use nested object as id attribute

Is it possible to use a nested object as the id attribute in Backbone? For e.g. something like, var MyModel = Backbone.Model.extend({ defaults : { 'info': { ...
0
votes
0answers
31 views

Calendar is not populating events through javascript object

I am new to javascript and trying to achieve events of calendar through this code. var jsonObj = []; for (var x = 0; x < incCntListSize; x++) { var date = $("#calloutDate_"+x).val(); var id = ...
0
votes
1answer
26 views

JavaScript field logged to console is always “undefined”

It's the first time i use objects with JavaScript, i used the method 1.1 from this tutorial, i have this code: function MyClass() { this.currentTime = 0; this.start = function() { ...
0
votes
1answer
30 views

Javascript object changing automatically?

I have the following code: var doneFile=convertToMOSTEM(curFile.file,curFile.color,curFile.importance); console.log('doneFile:'); console.log(doneFile); debugger; filesOS.add(doneFile); debugger; ...
2
votes
3answers
48 views

Set JSON property with fully qualified string

This question achieves kinda the opposite of what I'm trying to do. Basically, I have this object: var a = { b: { c: 'Foo' } } What I need to do is set the value of c given the ...
0
votes
0answers
19 views

access dynamically generated nested object name

I'm creating a nested object with random characters dynamically on page load. I can't figure out how to access the names dynamically. I'm using a library that needs the name of these objects to ...
0
votes
0answers
30 views

How to get multiple images from a prototype object in javascript?

im trying to figure out how to get multiple image objects with a prototype object. I know for a fact I can get 1 instance of an image.. But I would like to declare multiple images from an array and ...
0
votes
1answer
191 views

Using curl POST with variables defined in bash script functions

When I echo I get this, which runs when I enter it into the terminal curl -i \ -H "Accept: application/json" \ -H "Content-Type:application/json" \ -X POST --data ...
2
votes
3answers
67 views

Javascript object with .push() method

I want to create javascript object using .push() Method and create Key Value Pair. I have tried it, but it doesn't work. $("input[name^=ang_nama]").each(function() { ...
1
vote
4answers
75 views

Best Method to Merge Javascript Arrays into an Object Literal

I'm looking for a native JavaScript method to merge 2 arrays into a literal object. Turn this: var x = ["blue", "yellow", "red", "green", "brown", "grey", "gray", "orange"]; var y = ["james", ...
1
vote
2answers
68 views

jQuery OOP element parameters

I want to create a jquery slider using oop. This is the structure of my code : var photoGallery = new Slider(); function Slider(){ this.init(); } Slider.prototype = { el : { nav : ...
0
votes
1answer
14 views

jQuery Merging 2 objects with dynamic properties

I have 2 javascript objects. I need to merge them together, however one of them contains dynamic form field values, saved to variables. I have some example code here: http://jsfiddle.net/ZAa7L/ I ...
0
votes
1answer
110 views

Changing marker properties (google maps) when all marker-objects have the same name

I have a google map on my website that is populated with markers through PHP. What I don't understand is how I can identify each marker individually since all marker objects have the same name. This ...
0
votes
1answer
84 views

Pushing value into a multidimensional array

I have surfed the problem but couldn't get any possible solution .. Let's say i have a var like this var data = [ { 'a':10, 'b':20, 'c':30 ...
0
votes
1answer
24 views

Referring to object properties during declaration?

So I have this object, and I am wondering how I refer to other properties while declaring: var Chatter = function(io){ this.base_url = "http://chat.chatter.com:1337"; this.debug_on = true; ...

1 2 3 4 5 10
15 30 50 per page