Assigning the value of a variable to the name of another variable in JavaScript and Vue.js

I am dealing with 2 JSON arrays

"feeds":[
  {
     "created_at":"2021-11-28T00:11:38Z",
     "entry_id":17901,
     "field1":"16.40000",
     "field2":"45.50000",
     "field3":"16.06250",
     "field4":"5.20000",
     "field5":"49.79300",
     "field7":"1",
     "field8":"390267909"
  }
]

and

 "measurements":[
   {
      "user_id":1,
      "measurements_id":1,
      "fieldId":1,
      "name":"Unutrašnja temperatura vazduha",
      "unit":"°C",
      "url":"inner-temp.png"
   }]

In my current code, I retrieve the value of field1 using myField=feeds.field1 which gives me a value of 16.4000. However, I now have a requirement to dynamically add these values based on the fieldId property from the second JSON array measurements.

Essentially, I need something like:

myField='feeds.field'+measurements.fieldId
and once again, myField should be 16.4000.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issues with string encoding after using NSUTF8StringEncoding

When attempting to download a JSON string from a server, I noticed that the formatting is not as expected. Apologies for the confusion, I am new to using Stack Overflow. Upon comparing the received string with the var_dump output from PHP, I observed that ...

Move the li element to the left using jQuery slide effect

Currently, I am working on a slide viewer project. The ul contains 5 lis that are being displayed. I am looking to utilize jQuery to create a sliding effect where the li on the left is no longer visible and one of the hidden ones becomes shown. Can anyon ...

"Is there a way to retrieve the props that have been passed down to a

I am looking to have custom props created in the root layer of my React app: import React from 'react' import App, { Container } from 'next/app' export default class MyApp extends App { static async getInitialProps({ Component, rout ...

Encountered a problem when attempting to upload images to Cloudinary through the front-end and save the information in a MySQL database using Axios on Node JS

I am currently working on a web application using React. I have implemented a form where users can input text data and upload multiple image files. The goal is to store the submitted images on Cloudinary along with other text data in a MySQL database. Unf ...

Encountering an issue with vue.js while attempting to run a gulp production compile

While attempting to run gulp --production I encountered the following error: [14:27:45] Using gulpfile ~/www/webpage/gulpfile.js [14:27:45] Starting 'all'... [14:27:45] Starting 'task'... [14:27:45] Starting 'js-langs'... [14 ...

What is the best method for encrypting a URL that contains AngularJS data?

Here is the URL that needs to be encrypted: <a class="btn btn-success btn-sm btn-block" href="@Url.Action("myAction", "myController")?Id={{repeat.Id}}&HistoryId={{repeat.HistoryId}}" ng-cloak>View History</a> I am seeking guidance on enc ...

What is the process of combining two objects in TypeScript?

As part of my project, I am using two different get requests. The first request returns data in the form of: department: string[] The second get request provides an object structured like this: globalObj: { count: number[], admin: { department: ...

What is the best way to deactivate the second selection option?

<select id="title0"> <option value="0">--- disable</option> <option value="1"> books</option> </select> <button id="save" type="submit">Save</button> <select id="title1"> <option value="0"& ...

Is there a universal framework for PHP and JavaScript commands?

Looking for frameworks that handle PHP <=> JS (AKA "AJAX") communication with all the necessary boilerplate code included to make development smoother. Are there any options worth considering? I know there are libraries out there, but most I've ...

Splitting elements into two categories with Angular.JS: Comparing ng-hide and filter

My task is to take an object with data and display it in two separate lists. The structure of the object is as follows: var data = [ {name: "Something 1", active: 1, datetime: "goes", author: "here"}, {name: "Something 2", active: 0, datetime: "goes ...

regex for extracting a hyperlink tag from an HTML snippet in a server-side environment

On the server-side, I have an HTML page source stored as a string. My goal is to extract <link rel="icons"... elements from the string and store them in an array. There may be multiple <link rel="icons"... elements with the same starting tag, and I ...

Checking the Vue Version in Laravel: A Guide to Finding and Updating

Inside my package.json file, I noticed the following line: "vue": "^2.1.10", however after running npm update, a different email address is displayed: [email protected]. How can I determine which version of Vue is currently installed in my Laravel Ap ...

Parsing a child class from a JSON API to extract the data

I'm trying to deserialize a subclass from JSON using Xamarin (C#) Here are the classes: public class PhoneDirectory { public string name { get; set; } public string number { get; set; } } public class RootPhoneDirectory : List<PhoneDirect ...

FancyBox refuses to "pop"

I have been struggling for 2 hours to get FancyBox to work, and I cannot figure out why it is not working. It seems like I am missing something because instead of the image popping up, it just takes me to a new page. For example: I have linked both the th ...

Efficiently transferring components of a JavaScript project between files

For the first time, I am creating an npm package using ES6 and Babel. However, I am facing difficulties in connecting everything together so that it can be imported correctly by the end user. The structure of my build (output) folder is identical to src: ...

How to make divs occupy the entire space of a parent div?

I've been scouring the website for a solution, but nothing I've found has been helpful. I'm attempting to create a grid within a containing div where a default (and eventually user-specified) number of divs will fill up the space. I'm t ...

Having trouble loading data into tmpl using jQuery getJSON

I've been trying to load JSON data into a jQuery tmpl, but I'm running into some issues. You can find the page here. $(document).ready(function() { $.getJSON("http://stefairclough.com/jsontest/json.json", function(data){ ...

Update the color of the Navigation Div once it has moved past a certain div

I am trying to update the color of my navbar-toggle from white to black or black to white. The issue arises when it reaches a specific div with a class like 'white' or 'black'; the color changes as soon as the scroll starts. var stick ...

Automated accounts generated through Javascript and Ajax

To prevent accounts created by bots, I have implemented a simple Javascript function to change the ID of the form: setTimeout(function() { $("#FormAccountCreateTmp").attr("id", "FormAccountCreate"); }, 5400); After 5.4 seconds, the form originally with ...

Store a function as a variable in AngularJS

My goal is to dynamically call a function based on a variable that holds the function name. For instance: var fun =function1(1,2) Then later, fun could be assigned another function: fun= function2(2,3) This is just an example to illustrate my situation ...