Skip to main content

All Questions

0 votes
2 answers
77 views

I need to unstructure an object to update the variables defined in data

it's my first post. I need to destructure to update a variable defined in "data", I have the following code snippets. I'm using VUE. data: () => ({ id: '', phone: '', email: '' }), ...
Ricardo GC's user avatar
-1 votes
2 answers
5k views

How to create a Javascript object with index and values with variables?

I have a problem in my javascript code, i need to create an object with variables and those variables being objects too. Explanation: I need this in my javascript code (similar to a Json structure): ...
Frederico Gomes's user avatar
0 votes
1 answer
304 views

Flatten data from an object with an array of objects

In my Vue project, I'm doing an API call to my Laravel (nova) backend, the data is returned as follows. As you can see the data is an array, which contains an array of objects. Each array represents ...
Miguel Stevens's user avatar
0 votes
3 answers
284 views

Changing key value of object without discarding rest of keys

I would like to replace spaces with underscores for a specific key in all incoming objects. It works, however the rest of the keys dissappear. The objects: { "id": "235", "reference": "AA"...
Prozak's user avatar
  • 303
0 votes
2 answers
633 views

VueJS sort/order an array of objects by a specific property

I have an array of contact objects that all of an isPrimary property. Only one of them should be true, but regardless I would like to sort any primary contacts to the top of the array. I'm using ...
Matt Larsuma's user avatar
  • 1,504
1 vote
2 answers
44 views

Defining methods/functions on Javascript Objects

Is this: saveUpdate() { // Some code } The same as: saveUpdate: function() { // Some code } Is there a best practice (ES6) way to define methods on objects (specifically, Vue.js components)? ...
Ash's user avatar
  • 25.4k
-1 votes
2 answers
953 views

Why am I getting Cannot read property 'startsWith' of undefined in this for loop?

I am trying to sort an array by 'version' and then identify all string that begin with 'iPad'. The following code does not log anything and returns an error. orderedUsers: function () { let ...
david's user avatar
  • 6,695
-2 votes
2 answers
146 views

Which is the best way to filter data from an array with Vue JS?

I'm looking for best practices. I get this product list from my API: [ { "id": 6, "name": "Pechuga de pollo", "category": "Chicken", "existencia": 100 }, {...
Eduardo Reyes's user avatar
2 votes
3 answers
11k views

How to format an Array of Arrays of Object in JS

I want to formatting this Array in a computed property in VueJS, but I have one problem in the moment to access to newArray, all of elements in one only array getNewArray(){ const newArray = [] const ...
Cesar Armando's user avatar
0 votes
2 answers
366 views

vue data function syntax

I'm getting following syntax error when compilling my assets: Syntax Error: SyntaxError: C:\xampp\htdocs\dtcburger.com\resources\js\components\stripe\STRIPEform3.vue: Unexpected token, expected ";" (...
gabogabans's user avatar
  • 3,465
1 vote
4 answers
111 views

Filter out object by properties (not deleting)

I have an object which looks like this: var myObj: { 2:"None", 20:"A", 31:"A", 32:"A", Social:"B", Method:"None" } I am trying to return the object without the 'Social' and '...
senty's user avatar
  • 12.8k
0 votes
1 answer
201 views

Concat object array with the same name

I have an app in vue.js with vuex that implement some modules, what I'm doing is concatenating objects to get some actions, getters, mutations. Like this: const files = require.context('../../...
Marcelo Formentão's user avatar