Linked Questions

66 votes
2 answers
39k views

Is it possible to test a variable to see if it is a primitive? I have seen lots of questions about testing an variable to see if it is an object, but not testing for a primitive. This question is ...
Chris Snow's user avatar
  • 24.9k
0 votes
2 answers
6k views

jQuery.type() is deprecated in jQuery 3.3 and above. When refactoring older code that uses this API, what should I use instead of jQuery.type()? For example, one of the plugins my page relies on uses ...
Ectropy's user avatar
  • 1,541
3 votes
0 answers
4k views

I have a method: deepCopy (destination: any, source: any {...} and I would like to check if the source is of any primitive type in ExtJS it would look like Ext.isPrimitive(source) but I can't find a ...
Yoda's user avatar
  • 18.2k
-1 votes
3 answers
2k views

So right now, I created an example of a JSON object where: var myObj = { address: { 0: ["41 Lake Avenue"] }, name: "jake" } myObj itself as a whole is a JSON ...
Maxxx's user avatar
  • 3,798
4 votes
4 answers
157 views

I am trying to see if the property contains another object. I have this: { "prop1": "value", "prop2": "value", "prop4": "value", "prop5": { "innerprop1": "value", "innerprop2": "...
James's user avatar
  • 763
0 votes
1 answer
2k views

I am using the following code to check if an element is an object in javascript: element.constructor == Object Is this a correct way or there are more appropriate ways to check that? An alternate ...
sunny's user avatar
  • 189
0 votes
1 answer
1k views

I am trying to read a nested object as a key-value. I am using a recursive function to be able to enter each object and print its key-value. The problem is when I try to read a key-value where the ...
Geronimo's user avatar
  • 501
0 votes
2 answers
731 views

I try to extract Object from bellow array : var array = []; array = a,b,c,{"A":"0","f":"1","g":"2"},{"B":"5","v":"8","x":"4"},{"C":"0","f":"1","g":"2"},c,b imagine extract this : result = [ {"A":"0"...
faezanehhabib's user avatar
0 votes
1 answer
409 views

In my limited experience about object type judgment,I don't know how to judge whether a value is Object Literal in JavaScript? I am searching for a long time on net.But no use.Please help or try to ...
LinWei's user avatar
  • 7
0 votes
1 answer
456 views

According to the spec there are only 6 types, 5 of which are native ( Null, Undefined, Number, String, Boolean ) and 1 which is of type Object. Googled it. It appears that typeof fails for null and ...
user avatar
0 votes
1 answer
78 views

I have an update method that should update an item in array: function update(array) { return array.map(item => { // item or primitive? }) } What is the best way (in terms of reliability ...
undefined's user avatar
  • 6,974
5643 votes
47 answers
2.2m views

I'm using JSLint to go through JavaScript, and it's returning many suggestions to replace == (two equals signs) with === (three equals signs) when doing things like comparing idSele_UNVEHtype.value....
bcasp's user avatar
  • 57.3k
3143 votes
47 answers
3.1m views

Is there a universal JavaScript function that checks that a variable has a value and ensures that it's not undefined or null? I've got this code, but I'm not sure if it covers all cases: function ...
Alex's user avatar
  • 36k
1509 votes
28 answers
1.5m views

Given a string of JSON data, how can I safely turn that string into a JavaScript object? Obviously I can do this unsafely with something like: var obj = eval("(" + json + ')'); but that leaves me ...
Matt Sheppard's user avatar
441 votes
11 answers
162k views

I recently stumbled upon the Object.create() method in JavaScript, and am trying to deduce how it is different from creating a new instance of an object with new SomeFunction(), and when you would ...
Matt's user avatar
  • 41.9k

15 30 50 per page
1
2 3 4 5