Skip to main content

All Questions

0 votes
0 answers
36 views

How does this function know to search for my input?

So probably a silly question. How does this function know to replace "obj" with whatever object I put in, and replace "checkProp" with whatever property I put in? I'm pretty much ...
Zachary Adams's user avatar
1 vote
2 answers
715 views

create object property by assign value in a for loop

In this excercise I create 3 function. score() to generate a random Number. generateStudents() to create a list Object. Object has format {student:'name',marks:{...}} as define in generateStudents(). ...
linhcheee's user avatar
0 votes
0 answers
15 views

Learning to use functions in objects... I can't understand why my function is outputting undefined [duplicate]

So I am creating a simple object with one of the properties being a function... I cannot figure out why when I call it, it outputs undefined! Here is the code... const team = { partner1: "...
DaShaman's user avatar
  • 157
0 votes
1 answer
163 views

How to create a function that checks if a property exists in an object? [duplicate]

My task is to create a function that checks if a specific property exists in object. I don't understand why the second log returns false when 'b' obviously exists in numbers object. Would be very ...
gopetoamg's user avatar
1 vote
3 answers
107 views

JavaScript Objects is not recognised by it's property

my program is very simple - it should save movies in array and then print them in JSON format. The problem is with 'contains()' method (i think). It works well with one-named-movie but it returns null ...
yocalee's user avatar
  • 55
0 votes
1 answer
98 views

Cannot pass parameter to be property name for an object [duplicate]

const persons = { name: 'David', age: 40 }; const myFunction = (x) => { console.log(persons.x) }; myFunction('name'); If I pass myFunction('name'), I expect it to print 'David'. If ...
Dimisizz's user avatar
0 votes
1 answer
137 views

Pass object and properties by reference in Javascript

I've seen lots of questions about passing objects by reference in Javascript, but not the object and properties by reference. Is it possible? Right now I only found a way to do it by going through ...
Chewie The Chorkie's user avatar
0 votes
3 answers
129 views

Building Calculator, getting Cannot set property 'value' of null

I am building a Calculator and I keep getting this error, I've tried typing it a few different ways but I couldn't figure it out, help, please! const calculator = { displayValue: '0', ...
LucasO's user avatar
  • 15
0 votes
2 answers
57 views

i am trying to store my function call within an object

i am trying to store my function call within an object, so when i refenence the property, it runs the function. this is the code i wrote, but its not working. this is my code so far. html: <!...
Joe Misheski's user avatar
-1 votes
2 answers
38 views

Function to create properties of an object?

I'm new to javascript and I'm trying to code a game. I need to create an object that stocks the height of 10 "columns". These columns must be set to zero. so I need something like this : var ...
Corentin Fleur's user avatar
1 vote
1 answer
120 views

Is it a good practise to inject properties into ReactJS functional components using literal dot notation setters?

Fiddling with a React code written by someone else, I stumbled upon this pattern: // So far so good: const displayName = 'aComponentsName' const propTypes = { // not important } const ...
HynekS's user avatar
  • 3,097
1 vote
2 answers
1k views

Why I cannot and how I can assign a return value of function to object property?

Thank you for ideas! Console: "Uncaught TypeError: program.test is not a function..." let program = { name: "...something..." }; program.wantedKeys = program.test(); program.test = () =...
Martin Melichar's user avatar
-1 votes
2 answers
47 views

Why is this undefined when I call a functions property?

Here is my code: function myOuterFunction() { myInnerFunction(); var myObject = {say: myInnerFunction.myProperty1, say2: myInnerFunction.myProperty2 ...
Andy's user avatar
  • 25
0 votes
1 answer
3k views

Accessing Object Properties in Array VBA

I cannot figure out how to access object properties in an array using VBA. I have created an array like: Dim objectArray(10) as Variant Dim counter as Integer 'used to move to next ...
Brian Phair's user avatar
1 vote
2 answers
832 views

set property value when instance new object in javascript

I want to learn about this syntax below: (this is the three.js library) var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); What is ( { color: 0x00ff00 } ) ? I know: ( { property: ...
tom_so's user avatar
  • 121

15 30 50 per page