Linked Questions

1746 votes
9 answers
1.5m views

I am building some objects in JavaScript and pushing those objects into an array, I am storing the key I want to use in a variable then creating my objects like so: var key = "happyCount"; myArray....
490 votes
3 answers
675k views

If I have a javascript object that looks like below var columns = { left: true, center : false, right : false } and I have a function that is passed both the object, and a property name like so ...
Hailwood's user avatar
  • 93.2k
163 votes
10 answers
480k views

I have an object and I can reference key a as in the following: var obj = { a: "A", b: "B", c: "C" } console.log(obj.a); // return string : A I want to get the ...
Chameron's user avatar
  • 2,984
87 votes
3 answers
148k views

How to access an object using a variable as key. Here is my code sample: var o = {"k1": "111", "k2": "222"}; alert(o.k1); //working fine var key = "k"+1; alert(key); // k1 alert(o.key); //not working
23 votes
2 answers
20k views

I have an object var Messages = { 'fullName' : 'Tell us your cool name dude..! e.g. Yousuf Iqbal', 'userName' : 'Choose a catchy username. Remember! It should be available :)', 'password' : 'Choose ...
21 votes
2 answers
75k views

I can't figure out how to get an object property using a string representation of that property's name in javascript. For example, in the following script: consts = {'key' : 'value'} var stringKey = ...
Nelaina's user avatar
  • 17.9k
17 votes
2 answers
53k views

Let's asume that I have an object: var obj = {"A":"a", "B":"b", "x":"y", "a":"b"} When I want to refer to "A" I just write obj.A How to do it when I have key in a variable, i.e.: var key = "A"; Is ...
liysd's user avatar
  • 4,683
2 votes
4 answers
37k views

I am trying to parse a JSON in Javascript. The JSON is created as an ajax response: $.ajax(url, { dataType: "text", success: function(rawData, status, xhr) { var data; try { data = $...
9 votes
2 answers
5k views

var tinymce_toolbar = {} tinymce_toolbar.__default = { script_url: '/cms/libs/js/manual/renders/tiny_mce/tiny_mce.js', }; tinymce_toolbar.__simple = { script_url: '/cms/libs/js/manual/renders/...
ZiTAL's user avatar
  • 3,591
9 votes
1 answer
3k views

Trying to loop on all updated field I've got and update them dynamically before saving. Product.findOne({ _id: productNewData['_id'] }, function (err, doc) { for (var key in productNewData) { # ...
WebQube's user avatar
  • 9,011
2 votes
3 answers
11k views

I am using CKEditor, and, when referring to the CKEditor instance, I need to use a variable. But, since calling the instance is a object, I am really not sure how to do this. I am using: CKEDITOR....
2 votes
2 answers
26k views

I'm a complete beginner trying to learn Javascript. I am trying to complete a problem requiring me to return a value assigned to a key. The function is called getProperty and I am stuck - it keeps ...
4 votes
1 answer
7k views

I have a mongo DB, in the mongo shell, when I run "show collections", it returns the collection with dot in the collection name like a.1 a.2 a.3 How I refer it in command like db.a.1.find() the ...
5 votes
1 answer
3k views

Possible Duplicate: Dynamic object property name I have a function that I need to call based on a user inputted data. So for example, I have: models.cat models.dog Now, I want to be able to call ...
Alexis's user avatar
  • 25.6k
5 votes
3 answers
5k views

I want to get the value of an object field from JSON. I have a dynamic variable let check_permission_key = 'ratingscalename'; and have one JSON let overwrite_key = { studentimage: 'student', ...

15 30 50 per page
1
2 3 4 5
...
69