Category "javascript-objects"

How do I test for an empty JavaScript object?

After an AJAX request, sometimes my application may return an empty object, like: var a = {}; How can I check whether that's the case?

Creating service in React Typescript using axios

There are two different ways to create a service and call from the required funtional component. 1. export const userProfileService = { ResetPassword: asyn

looping through an array of objects that contains three key, value pairs

I have these objects, which could be in an array, like in the example or a database: [ { "payer": "DANNON", "points": 1000, "timestamp": "2020-11-02T14:00:0

Make JSON.parse work for array of objects with quotation mark

I am trying to store an array of object as string and restore it later. However, some elements in the objects are string and they may have ' or ". This causes a

javascript object Assignment an array

i have an object and with specific key a assign an array denemeobject['items'] = Object.values( JSON.parse(results.rows.item(index).BarcodeArr

Typing Object.fromEntries(new FormData(form))

TypeScript newbie here, having problems with Object.fromEntries. I'm trying to pares form and cast its values to something else. For example, given homogeneous

From an array of objects, extract value of a property as array

I have JavaScript object array with the following structure: objArray = [ { foo: 1, bar: 2}, { foo: 3, bar: 4}, { foo: 5, bar: 6} ]; I want to extract a fiel

JavaScript: Best way to add custom properties/methods to built-in objects (e.g. arrays)

It is known that you should not customize the built-in prototypes in JavaScript. But, what is the best way to add custom properties/methods to specific instance

'require.context' is not returning file names

I am working on a NextJS app and have created a few functions that facilitate a user uploading files. Files uploaded by the user will live in the "../public/upl

Link between two JavaScript objects and then create condition

I have this set of data : [ { CIRPIC: 'SAL', ALLPIC: [7, 8, 9, 10] }, { CIRPIC: 'SUC', ALLPIC: [5, 6, 7] }, { CIRPIC: 'LI3', A

How to download CSV from a nested object in javascript?

I want to iterate over an object in Javascript and create a CSV file from its internal objects. const list = { "right": { "label": "Right",

Access value from a string object - Javascript

Not sure why I am not able to access the keys from a string object data looks like this I am getting this data from a python variable const data = '{regression:

What is a rich object?

I'm learning Express. While doing a tutorial, I stopped to try to figure out why the tutor used express.urlencoded({extended: false}). I learned what url-encodi

Transform JSON into required format

Here is my input JSON [ { "date": { "value": "2022-05-01" }, "parent": { "value":

freeCodeCamp Challenge Guide: Use the reduce Method to Analyze Data

I am in the freeCodeCamp Use the reduce Method to Analyze Data challenge. I tried: function getRating(watchList){ // Add your code below this line var count

Create a new array of boolean values by comparing two arrays with objects

I have a question about creating JavaScript arrays. Here's what I want to do. I have two arrays. Each array has object(s) in them. The first array has exactly 5

Jquery Object and Array implementation

I have an Object let data = { a: 1, b: 2, c: { abc: "ak", bcd: "gh", cfv: "ht" } } the

How I could use template literals in javascript in a variable name?

I want to declare a variable name via template literals How it is possible ? let z = 3; let test`${z}` = "hello"; //or = new obj() for example console.log

How to call recognition.onresult to an API function in Javascript?

Im working on a voice recognition system where a voice command can pull up NASA's Astronomy Picture of the Day through their NASA API. I've made some simple cod

Loop or map array inside the JavaScript object

I have an array of javascript objects like: const arrayData = [ { name: "campaign 1", date: "2022-05-13", milestones:[{name:"Planning", targetDate: "2022-05-25"