Skip to main content

Questions tagged [javascript-objects]

Use this tag for questions related to JavaScript objects.

javascript-objects
0 votes
1 answer
29 views

Why is the below piece of code giving error when I add console log line and working fine if I remove it?

The code below works fine if I remove the console log line but not with it function gcd(a, b) { while (b !== 0) { console.log(a,b) [a, b] = [b, a % b]; } return a; } ...
Rajashekar Reddy's user avatar
0 votes
0 answers
18 views

Prototype is showing multiple times [duplicate]

I have implemented inheritance as below: class Animal { constructor(name) { this.name = name; } speak() { console.log(${this.name} is making noise.)...
meallhour's user avatar
  • 15.1k
0 votes
0 answers
28 views

Having error in javascript while creating pdf compressor tool

I am creating a PDF compressor tool via javascript. My pdf is uploaded, processed, and downloaded successfully. It shows the difference between the original size and the compressed size. Everything is ...
vikram's user avatar
  • 11
1 vote
2 answers
82 views

Why is reading the length property of a string in JavaScript O(1) and not O(n)

Strings are primitives, meaning they don't actually have methods or properties associated with them. According to MDN In contexts where a method is to be invoked on a primitive string or a property ...
Sincere Tuitt's user avatar
0 votes
1 answer
40 views

How do I access dynamically created objects and their properties in JavaScript?

If I write a function that creates a new person and attach it to an onClick event on a button, how can I access the data that was entered without a variable name? When a user presses the button, the ...
Jason Bruce's user avatar
-2 votes
0 answers
84 views

polyfill.io How can I know if My app is using it [duplicate]

I received a Google security notificación about The use of polyfill.io in The asset where I use Google Javascript API. But How can I know if i make a call to that library. Checking The app I don't ...
Luis Treviño's user avatar
1 vote
2 answers
91 views

Destructuring an array of variables from an unknown object [closed]

I just have a question if it is possible to destructure an object using an array of variables. I know it is possible if you know the name of the Object Keys but if you do not know the keys of the ...
Sarah Jane's user avatar
0 votes
0 answers
12 views

property accessory containing everything in javascript [duplicate]

I have this kind of javascript property. currencies.EUR.name: "Euro" Between dot notation EUR could be something else like USD. With javascript how could I change that to something like ...
Hegetsu's user avatar
1 vote
0 answers
29 views

proxy for 3d array, knowing the two indexes of array inside the handler function

I have this JavaScript Proxy code which I want to trigger the set handler that can tell me the first and second keys. This means that when I try to set globalVar.a.b = "55b" only the line ...
dede's user avatar
  • 31
0 votes
0 answers
13 views

How can I call a method within the same object literal where it's defined in JavaScript? [duplicate]

const objTest = { testFunctionToDoubleAValue: (testParameter) => testParameter * 2, testValue: 1, testValueDoubled: testFunctionToDoubleAValue(1), } I tried to access a function inside the ...
CandleLearner's user avatar
0 votes
0 answers
33 views

Displaying the movement of a 3D model with data from an ESP32 gyroscope

I'm having a problem showing the movement of my ESP32 using the three.js library. The code reads the data generated by the gyroscope and implements it to the 3D model. It is not fluid and even the ...
Midas Estanislao's user avatar
1 vote
0 answers
16 views

Why does the name of a property change what access method works?

I have an object named facility facility = { facility_id: 495867, facility_name: "4 Pig farms Brookvale", registered_business_name: "BROOKVALE FARMS COMPANY PTY LTD", ...
That_LEGO_Guy's user avatar
0 votes
4 answers
57 views

get total of empty values in an object

please I need help with this const obj = {a="", b="good", c=false, d="", e="excellent"} I just want to know total empty and false. where my answer is suppose ...
yusufff's user avatar
  • 51
0 votes
1 answer
46 views

Inserting Javascript array elements into another array with ternary operator

I have an array of objects where each object defines a field in a React form. I want to display different sequence of fields depending on a boolean state. This means that I need to insert either one ...
VikSil's user avatar
  • 98
0 votes
2 answers
53 views

How do I check if a the mouse has touched a Javascript object that is randomly generated?

I am attempting to create a game where objects (currently circles) are randomly generated within a canvas, and the objects and their positions (plus other info) are stored within an array. The objects ...
BlueClub's user avatar

15 30 50 per page
1
2 3 4 5
481