Questions tagged [javascript-objects]

Use this tag for questions related to JavaScript objects.

Filter by
Sorted by
Tagged with
-3 votes
0 answers
25 views

Working on objects without directly modifying the original one

I have a JavaScript challenge in which I am asked to do a couple of things: -Add a new property to the personProfile called personName and set this to the value of 'John'. -Remove the property called ...
Fred's user avatar
  • 1
0 votes
1 answer
21 views

NodeRed to MongoDB operation with a Javascript object

So for a part school exercise, part my own project, I'm trying to make a NodeRed server that returns weather data, saves it to MongoDB and returns it on future searches for the same location. My ...
TasH's user avatar
  • 11
0 votes
0 answers
14 views

Splicing an Object from within an Object (JavaScript/HTML) [duplicate]

What is a method I can use to splice an object from within an object. I have an Object called Bullets. Inside of the there is the users ID, ('User1'). Inside of the User1 Object, is all the bullets ...
ICodeForFun's user avatar
0 votes
0 answers
39 views

How to access an array within an object within an array in JavaScript? [duplicate]

EDIT: Since my question has been closed due to being considered too similar to other question already answered, I decided to edit it and try to be more specific. Also, I considered what the people ...
Guilherme Jorge Huyer's user avatar
0 votes
0 answers
7 views

Javascript: Objects instantiated inside function gets garbage collected?

I have an object constructor, which will be called within another function. Code provided below // object constructor Book function Book(title, author, pages, read) { this.title = title; ...
Ganglin Wu's user avatar
0 votes
1 answer
29 views

Cannot read properties of null (reading 'removeChild') at TooltipContent.dispose on echart

I am setting my option data dynamically for echart(pie). I used this to set option dynamically var myChart = echarts.init(document.getElementById('chartId')); myChart.setOption(this.chartOption , true)...
Harsh Tukadiya's user avatar
-3 votes
2 answers
42 views

javascript Objects assignment node js

I am new to JavaScript and going through some of objects example, can some please explain below code... const car = {type:"Fiat", model:"500", color:"white"}; const {type} = car; console.log(type) ...
Prashant Mani's user avatar
-2 votes
2 answers
43 views

How to convert an array of objects into an array of arrays using Ramda

I would like to transform this: [ { a: 2000, b: 4000 }, { a: 8000, b: 5000 }, { a: 6000, b: 1000 } ]; Into this: [ [ 2000, 8000, 6000 ], [ 4000, 5000, 1000 ] ]; Using Ramda. I can do this ...
user22275934's user avatar
0 votes
0 answers
14 views

Appending a string or number to a object key to return value [duplicate]

I have a pretty simple straight forward question. I would like to be able to append either a number or string to a JavaScript object to return a value. Here is a simple example of what I am trying to ...
navin1551's user avatar
0 votes
0 answers
21 views

How can I extract specific columns from a CSV file using papaparse and display them using React?

I'm working on a React application, and I have a CSV file that contains data in a structured format. I want to extract specific columns from this CSV file and display them in a table on my React app. ...
chirag vats's user avatar
0 votes
3 answers
36 views

create map for same keys and multiple values from api reponse

I am receving a response in javascript like below . I have given one example. There will be lots of different table_id coming with different values. var a = [{ table_id: 11111111, ...
hellraizer's user avatar
-1 votes
2 answers
74 views

JavaScript optimize array of objects

Hi I'm creating an array this.data = [{ label: 'Total', count: details.request.length, }, { label: 'In-Progress', count: details.request.filter((obj) => obj.statusId === 0 || obj....
Kriti's user avatar
  • 7
-2 votes
2 answers
76 views

How to replace an object in an array with another object based on property? [duplicate]

I would like to efficiently replace an object in an array with another object based on a property of that object in JavaScript. Here is an example below: const oldEmployees = [ {id: 1, name: 'Jon', ...
navin1551's user avatar
0 votes
2 answers
51 views

Shortcut version getting some object values into array in certain order?

I have object with many keys, I want to get some of corresponding values into array, in certain order. To get these values I can use deconstruction like const obj = { foo: 1, bar: 3, baz: 2, other: ...
w.k's user avatar
  • 8,238
-2 votes
1 answer
20 views

I am getting undefined as an error when i run the code even though I have defined the variable

<!DOCTYPE html> <html> <head> <title> JavaScript Object </title> </head> <body> <h1> Creating javaScript Object&...
Shweta Chanagoudar's user avatar
0 votes
0 answers
25 views

Javascript UrlFetchApp

I am new to this and trying to access the content of my URL request,but JSON.parse is not helping at all. My eventual goal is to set these values into a Google sheet.(GAS) My output is the following: {...
GBM's user avatar
  • 1
0 votes
0 answers
10 views

this keyword is outputing different outputs in same object why? [duplicate]

i learned that this keyword inside an object method this refers to the object it self but when it tried it not why, when i tried that in arrow function syntax this keyword referred to the object it ...
Moayad344's user avatar
0 votes
2 answers
23 views

Get excel data and post to server side using ajax

I am trying to gather the data from excel using the js and ajax var ExcelToJSON = function () { this.parseExcel = function (file) { var reader = new FileReader(); reader.onload ...
hey hej's user avatar
0 votes
0 answers
9 views

JavaScript , Inquirer : Getting an error for user defined Imported function

The below program is taking the CLI input from the user and is printing to the text file. **Question **: the program is giving an error when passing the user promise "result" to the imported ...
arjun's user avatar
  • 1
1 vote
1 answer
27 views

How can I identify using Array proper/key name and then filter another object by that?

I have two sets of data. How can I loop and get the array property/key name to filter another object with it and merge them into a new array. I tried using Map/filter/find but was unable to do it. In ...
Strugglingwithbugs's user avatar
-4 votes
1 answer
56 views

Comparing 2 objects and searching for differences

I have 2 objects (created with Syncfusion editor - Word) and I need to compare if something inside the document (text) has been changed and it's working at least 50% but I don't know how to fix it ...
Daniel Díaz's user avatar
0 votes
1 answer
35 views

Memoized function implementation in JS. How does it work?

I was in an interview recently where I was asked a coding question in JavaScript. The question was regarding the implementation of memoization of a function. I figured that we need to store the ...
Achu Anil's user avatar
0 votes
0 answers
17 views

Javascript Chrome Extension Help: Getting user highlighted text on a webpage [duplicate]

I am trying to make a chrome extension that gets text highlighted by a user, and then displays it in my chrome extension, but am unable to figure it out. I checked many other similar stackoverflow ...
user19683926's user avatar
0 votes
1 answer
34 views

Covert base64EncodedData to binary and download it as file in postman

I am working on automating a new set of APIs and one issue encountered is that one of APIs is returning a base64 encoded file. eg: var base64EncodedData=iVBORw0KGgoAAAANSUhEUgAAAMsAAAAyCAYAAADyZi/...
abhishek pandey's user avatar
0 votes
0 answers
49 views

Merge child object value to parent key based on key name using Javascript

I have a large nested JSON object which has been auto-generated from an XML schema. This resulted in multiple children keys being created and nested within themselves. The following code snippet ...
Debaditya Sen's user avatar
0 votes
1 answer
34 views

I am just confused in how the forin loop in js is used and why do we use const keyword in it

I have a object named user where one of the properties is skills and im trying to find a user who have the maximum no. of skills. let maximum = 0; let name; for (const user in users) { const len = ...
s-chuck's user avatar
  • 23
1 vote
2 answers
47 views

remove inner <mark> tags using jquery

I have a paragraph where some words are highlighted using <mark> tag. But when the document is ready, some of the words contains <mark>tag inside another <mark> tag. i.e <mark>&...
Khan's user avatar
  • 11
0 votes
2 answers
52 views

React: Unable to add object to existing array in hook

I'm working trying to add an object created from data returned in an AXIOS request to state in a React Application. The object itself appears to be fine and even prints out as expected without errors ...
TeaDrinker's user avatar
0 votes
1 answer
29 views

how to refresh part of a component in react.js

import React,{useEffect} from 'react'; import CloudTables from '@cloudtables/react'; import { useState } from 'react'; function DataGridTable ({ input1Value, input2Value }) { return ( &...
Yunus Emre Ceylan's user avatar
-2 votes
1 answer
38 views

js finding objects last key with minus 1, why? [duplicate]

to get the last key of an object this is what i must write, but i don't understand why we need minus -1 Object.keys(myObject)[Object.keys(myObject).length - 1] I have tried to remove minus 1 and it ...
user_unknown's user avatar
0 votes
1 answer
55 views

How can I swap array object values using Vanilla JavaScript?

I'm trying to update a private variable inside of a class. The variable is an array with objects in it. The goal is to have the array.index values swap places for drag and drop functionality. However, ...
TK421's user avatar
  • 811
0 votes
3 answers
77 views

JAVASCRIPT: Console.log() does not print the value of arrays (with objects) correctly. Instead, it prints a summary

I have this simple javascript app. let array = [{ fruit: "banana" }]; console.log(array); array.push({ fruit: "apple" }); console.log(array); I expect the first console.log() to ...
Dalibor Pavlik's user avatar
1 vote
1 answer
32 views

Move Javascript array key forward?

I have 2 items in my object, 1 and 2. structure concept I want to add to each item a second frame and to move the: second frame -> third frame, third frame -> fourth frame (notice that I ...
user_unknown's user avatar
1 vote
0 answers
36 views

React-Scroll Library: Active Style Not Applied on 'About' and 'Skill' Buttons Click"

I'm currently working with the 'react-scroll' library and have utilized the methods activeClass="active" . The intention behind this is to apply CSS styles from the class 'active' when ...
Jorge Leonardo's user avatar
-2 votes
2 answers
43 views

JavaScript array unshift if values present in other array

I've two array of objects one selected and other general data which we're displaying General data for display const arr = [ { id: "1", name: "Skoda - Auto" }, { ...
Kriti's user avatar
  • 7
0 votes
1 answer
34 views

Copying backup Object seems to copy in reverse direction

Finally had a problem that I can reproduce in small code. Result is in Console. Is the snippit background considered the same as Global? Copying an array into Object (from [] format) works (first ...
WayneF's user avatar
  • 235
-3 votes
1 answer
34 views

JavaScript array of object find property values if/Else if condition

I've an array of object and check for property values and based on it i need to perform some operation const arr= [ { "id": "1", "name": "Skoda - Auto", "operation": "...
Kriti's user avatar
  • 7
0 votes
1 answer
49 views

JavaScript merge arrays unshift with unique IDs [duplicate]

I've two arrays of objects: var arr1 = [{ "id": "id_1", "name": "Skoda" }, { "id": "id_2", "name": "BMW" }]; ...
Ashok's user avatar
  • 13
0 votes
1 answer
51 views

attributes.getNamedItem('style') is null

The logic bellow create a div element that display image as base64 format. when I try to get the value of attribute style which contains the URL base64 of the image I get this error attributes....
Anas Radi's user avatar
0 votes
2 answers
45 views

Console log duplicated using UseEffect hook

I have the following js file where I'm trying to replicate a request I made through postman to the api url http://localhost:1777/api/test My objective was to simulate that request and have the ...
developerDeadInside's user avatar
0 votes
0 answers
72 views

React Native "main" Component Not Registered (Invariant Violation)

I'm encountering an issue with my React Native project where I'm getting the following error: 3492ms ERROR Invariant Violation: "main" has not been registered. This can happen if: Metro (...
Rapidhunter's user avatar
0 votes
0 answers
27 views

How to use JSDoc and ts-check with a vanilla JavaScript constructor that returns a value directly?

Using vanilla JavaScript, I want to code a constructor that creates its instances by returning an object instead of using this. As explained on MDN: Normally constructors don't return a value, but ...
ruffin's user avatar
  • 16.6k
0 votes
1 answer
35 views

Cannot save object to localstorage

I am building a bookcase to store information about books that someone is reading. I want to be able to store whatever information has been entered so that it doesn't disappear after page refresh. I ...
Elizabeth's user avatar
0 votes
0 answers
15 views

Typescript derives different types when a static method is called from inside or outside a class

Can someone help me explain the behavior of typescript in this example. I have no idea what is going on here. Why is childProxy1.foo not resolved while childProxy2.foo is resolved correctly? Why is ...
Micha Stubi's user avatar
-2 votes
1 answer
56 views

JavaScript dictionary data length

{ "F1.1": { "add": [ { "id": 169138, "name": "volkswagen" }, { ...
Ashok's user avatar
  • 13
0 votes
1 answer
89 views

forEachResult() method is limited to 4000 rows in the result set returned

Good day! our NetSuite suitelet script is limited to 4000 rows in the result set returned, any idea on how do we script to be able to more than 4000 rows using the forEachResult() method? var ...
Norberto Locsin Jr's user avatar
-1 votes
2 answers
29 views

Read the array values by key in object return from a custom js file using nodejs file system

I have a config file which has the following format from a file: define([], function () { return { productItems: { item1: ['Apple', 'Ball', 'Car'], ...
Arvin Salvador's user avatar
0 votes
0 answers
45 views

How can I make a google chrome extension for email?

I need to write a google chrome extension for email. When the user enters the recipient's address in the form and clicks the submit button, but the recipient's domain does not match the organization's ...
Vlad Kovrizhnykh's user avatar
0 votes
1 answer
55 views

Getting Map is not defined in wso2 script tag

When I create a map like below var detailsMap = new Map(); I'm getting below exception. ScriptMediator The script engine returned an error executing the inlined js script function mediate com.sun....
Praveen kumar's user avatar
0 votes
0 answers
13 views

Javascript - Replace all values of keys in an object to lowercase and sum existing values in an object creating new total value

I have some jumbled string values in an object and I would like to replace them all with versions that are all lowercase. Also, I only need to know the total number of books. So i am deleting ...
TheFall1976's user avatar

1
2 3 4 5
144