Category "javascript-objects"

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"

How to access a function defined as key of an object from within another function defined as key of same object in JS

Given below code, I need to reuse functionality from innerFunc1 and innerFunc2 in innerfunc3, but I am not sure, how innerFunc1 and innerFunc2 can be accessed i

How can I 'not allow' the user to retrieve same information from the server multiple times in my 'React' Weather-app?

I'm learning React and as a practice I'm building a weather-app. My App Photo Everything is ok. but I want When a User type a City name for example 'London' and

How do I check if an array includes a value in JavaScript?

What is the most concise and efficient way to find out if a JavaScript array contains a value? This is the only way I know to do it: function contains(a, obj) {

How to map more than one property from an array of objects

I have an array of Object as follows: var obj = [ {a: 1, b: 5, c: 9}, {a: 2, b: 6, c: 10}, {a: 3, b: 7, c: 11}, {a: 4, b: 8, c: 12} ]; I know about how

Find paths between nodes in JS object graph

How can I get this result: [ {Paris,Amsterdam,Berlin}, {Paris,Bruxelles,Amsterdam,Berlin}, {Paris,Bruxelles,Berlin} ] from this array: [ { HD: '9:2