tagged [javascript]

What is the difference between React Native and React?

What is the difference between React Native and React? I have started to learn out of curiosity and wanted to know the difference between React and React Native - though could not find a satisfactory ...

How do I declare a namespace in JavaScript?

How do I declare a namespace in JavaScript? How do I create a namespace in JavaScript so that my objects and functions aren't overwritten by other same-named objects and functions? I've used the follo...

Find object by id in an array of JavaScript objects

Find object by id in an array of JavaScript objects I've got an array: I'm unable to change the structure of the array. I'm being passed an id of `45`, and I want to get `'bar'` for that object in the...

How can I check if an object is an array?

How can I check if an object is an array? I'm trying to write a function that either accepts a list of strings, or a single string. If it's a string, then I want to convert it to an array with just th...

14 Aug at 07:41

How do I correctly clone a JavaScript object?

How do I correctly clone a JavaScript object? I have an object `x`. I'd like to copy it as object `y`, such that changes to `y` do not modify `x`. I realized that copying objects derived from built-in...

30 Apr at 19:52

jQuery: Check if div with certain class name exists

jQuery: Check if div with certain class name exists Using jQuery I'm programmatically generating a bunch of `div`'s like this: Somewhere else in my code I need to detect if these DIVs exist. The class...

How can I merge properties of two JavaScript objects dynamically?

How can I merge properties of two JavaScript objects dynamically? I need to be able to merge two (very simple) JavaScript objects at runtime. For example I'd like to: Is there a built in way to do thi...

15 Dec at 17:58

Remove property for all objects in array

Remove property for all objects in array I want to remove the `bad` property from every object in the array. Is there a better way to do it than using a `for` loop and deleting it from every object? `...

19 Sep at 12:43

How to iterate over a JavaScript object?

How to iterate over a JavaScript object? I have an object in JavaScript: I want to use a `for` loop to get its properties. And I want to iterate it in parts (not all object properties at once). With a...

Number of elements in a javascript object

Number of elements in a javascript object Is there a way to get (from somewhere) the number of elements in a Javascript object?? (i.e. constant-time complexity). I can't find a property or method that...