All Questions
12 questions
-2
votes
2
answers
557
views
how can I use Array.find() function to edit name and age properties inside specific object
I can go with find for editing one property like in this example. But I didn't find a syntax to edit more than one property.
const arr = [
{
id: 101,
name: “Jone”,
age: 1
},
{
id:...
-1
votes
2
answers
53
views
Js obj with key name defined by Object.keys
var c = {
'aa-bb': [{ a: 1, v: 2}],
'cc-xz': [{ c: 2}]
}
console.log(Object.keys(c))
I need to create an object, whose keys (the name) must be from Object.keys.
For each key name an object of ...
5
votes
0
answers
431
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 ...
1
vote
1
answer
99
views
Destructuring with default objects for nested object
I have a requirement where I have to take a couple of values from a nested object which when not available, should be taken from a default object. For example consider the following object:
const ...
1
vote
2
answers
46
views
How to Merge Objects Of Varying Properties And Lengths Without Duplicates
I am attempting to merge two objects that both, have some same keys/associated arrays and different keys. The associated arrays are also of different length. To give you a better picture, I have ...
0
votes
2
answers
267
views
Move last object property to the first index [duplicate]
Lets say i have an array of objects:
let movies = [
{
"title": "Last Flag Flying",
"year": 2017,
"cast": ["Steve Carell","Bryan Cranston"],
"genres": ["Comedy","Drama"],
"id": 1
},...
3
votes
2
answers
64
views
How get value in the object in the array, if array is in the object and the object in the next array?
Expected effect: iterate objects in array, get value example 'email' in objects in array comments.
I would like to spell the array and nested objects and arrays and return the 'email' value. When I ...
0
votes
2
answers
118
views
How can I provide protection and confidentiality?
I want to restrict access to certain things in the JavaScript language from the outside. I've done some research on this, but I haven't been able to get anything I want. I know the underscore doesn't ...
-1
votes
3
answers
2k
views
conditionally deconstruct object (javascript) [closed]
I want to check an argument, if it was undefined (or false), I will assign a value to it by deconstructing an object
function test(x){
let obj={x:1,y:2}
if(!x){x}=obj;
}
note:
I don't want to use ...
1
vote
1
answer
2k
views
javascript auto call function in object
I need to create a dynamic object. I'll store all of these objects in an array. Each object will have some property and objects. After the object is created, I need to do an auto execute method from ...
1
vote
4
answers
266
views
How to merge multiple objects into one?
I am looking for a way to merge many objects with the same key to a one big object. The number of objects can be more that 2.
For example I have this code:
const a = {
en: {
hello: 'Hello'
},...
2
votes
1
answer
117
views
Complex filter between 2 objects and a boolean
I have this array burgerActions :
[
{
statusId: 2,
label: 'Accept'
},
{
statusId: 3,
label: 'Reject'
},
{
label: 'Consult'
},
{
label: 'Transfer'
}
]
and this ...