Skip to main content

All Questions

Tagged with
99 questions with no upvoted or accepted answers
5 votes
0 answers
399 views

JavaScript - proxy object to behave like primitive

I'm trying to build a system that "caches" calls to a library before that library has loaded. This is similar to what the Google Analytics "setup" code is doing with the _gaq variable - it's ...
Tibi Neagu's user avatar
4 votes
4 answers
2k views

Get previous object item in javascript

I have an object with keys and data. From a key I want to get the previous item. I've seen similar topics before but the solutions are really complicated. I also added a function that does not work ...
Jens Törnell's user avatar
3 votes
2 answers
126 views

How can I reduce the logarithmic cost of this function

At the work we are now trying to improve the performance of the code. So, to do that, we want to avoid the logarithm cost of the functions. If you have a loop inside of a loop it has a higher cost, ...
ValRob's user avatar
  • 2,544
2 votes
0 answers
93 views

Javascript Object() vs new Object() for ES6

I've seen a number of questions about new Object vs new Object() or new Object() vs {}, but I'm wondering about what the difference is between Object() and new Object()? In other words, what's the ...
mishar's user avatar
  • 455
2 votes
0 answers
300 views

Internal Methods [[GetOwnProperty]]

I faced an question when I was reading ECMAScript® 2021 Language Specification. In this document in section "6.1.7.2 Object Internal Methods and Internal Slots" in "Table 6", ...
Reza's user avatar
  • 543
2 votes
3 answers
912 views

handle multiple checkboxes and complex data structure (reactjs)

Since I am pretty new to React and also not a huge expert on JS especially ES6, I wonder how to make my code (that works) prettier and refactor it. I want to handle multiple checkboxes in a form and ...
André's user avatar
  • 1,218
2 votes
3 answers
2k views

Can I import one method from object.freeze

export default Object.freeze({ fetchReseller: ({ offset, limit }) => ({ type: FETCH_RESELLER, payload: { offset, limit }, }), // deleteReseller: ... etc }) How do I import only one ...
kuka's user avatar
  • 733
1 vote
2 answers
52 views

Converting object to array with objects

I need help sorting this out, I tried object.keys with map, but can't get too far, so, I have this object and each key has an array: const first = { "apples": [ "5.78", ...
ifkas's user avatar
  • 43
1 vote
2 answers
81 views

How to map an array of Object in Javascript

I am stuck with mapping in array of objects. Please find the below code const array = [ { user: "User1", cities: ["city1", "city2", "city3"], }, { ...
Adarsha Beleyur's user avatar
1 vote
1 answer
160 views

JS or TS - Getting the keys of a interface

Say I have an interface like: export interface Album{ id: string, code: string, title: string, description: string, publisher: string, } (It's actually quite long - I've just ...
userMod2's user avatar
  • 8,740
1 vote
5 answers
500 views

How to delete an item from an object of ids

const comments = { '1': { id: '1', text: 'please add code examples' }, '2': { id: '2', text: 'examples would be great for this article' }, '3': { id: '3', text: 'hi there' }, }; const ...
Ada's user avatar
  • 569
1 vote
2 answers
700 views

Destructuring an Object fields and Calculating the Sum in Javascript

I am having trouble figuring out how to destructure and add the total sum of an object with fields. Previously we bad separate objects in an object array. Now they are summed in 1 object and it looks ...
lost9123193's user avatar
  • 10.9k
1 vote
3 answers
63 views

Iterating a Json object and storing the end result

I am trying to iterate a JSON object which is an array of categories.The categories may or may not have the subcategory. If hasSubcategory = false , then category id should be stored in final array. ...
Sathya Narayanan GVK's user avatar
1 vote
1 answer
751 views

How to replace array.join using a comma with using a line break

I am using rest parameters ... to collect all keys in an array. For mapping the wanted keys, you could join all wanted property values. using function getValues(array, ...keys) { return ...
Shei's user avatar
  • 463
1 vote
1 answer
308 views

Getting items from objectstore returns [object Object] in HTML

Right now I'm looping through all objects in the object store "tasksStore". When I try to embed the objects into my HTML it only returns [object Object]. If I try to specify a part of the ...
DanielK's user avatar
  • 267

15 30 50 per page
1
2 3 4 5
7