All Questions
44
questions
0
votes
1
answer
369
views
How to make a method, that accepts an input, into a property of a class object?
The issue I've encountered here, is that I am currently trying to make an object that has a method as a property. I was able to get it to work on public static void methods, but not methods that ...
0
votes
2
answers
339
views
How do I make the child object not inherit a method or property from the parent object?
I'm creating a child object using class, but I don't want it to inherit some properties and methods from the parent object.
I want to know if there is any way to do this.
my code:
class Player {
#...
2
votes
1
answer
69
views
Using methods to select an object's property and assign it a value creates an error
I am trying to write a method that based on some value, returns a property that I'd like to define in another method. However, I am having a strange 'Uncaught ReferenceError: Invalid left-hand side in ...
1
vote
1
answer
902
views
Remove object key but keep its properties
Let's say there is an object that looks like this:
const before = {
keyToBeRemoved: { // <-- remove the key
name1: "value 1", // <-- keep the property
name2: "value ...
0
votes
1
answer
17
views
Sorting - methods and properties of objects
Hey stackoverflow, I was working on a project that was meant to take the methods and properties of different API's and then making a system that would allow these to be chained together and used with ...
0
votes
1
answer
555
views
having different values in the properties of the same object in an array of objects
why i have a value the same object in an array but when i select it like this arr[0] i find in the console diffrent values
class Player {
constructor(x){
this.x = x
}
move(code)...
0
votes
0
answers
28
views
Object.defineProperties don't work with negative property
Briefly,
Changing the properties name of the first example of MDN page
var obj = {};
Object.defineProperties(obj, {
1: {
value: true,
writable: true
},
-1: {
value: 'Hello',
...
0
votes
2
answers
457
views
Method that can alter multiple properties within an object in Python [duplicate]
I am trying to use a method within an object to selectively change specific properties of that object. I haven't been able to figure out how to get the method to recognize the values that I pass to it ...
0
votes
0
answers
17
views
What is the difference between function as method and function as property? [duplicate]
The function in JavaScript object are recognized as methods or properties depending by code.
What is the difference? Maybe a vscode bug?
I couldn't figure it out, so please tell me why.
0
votes
1
answer
38
views
Javascript self referential value in object as variable in second value of same object [duplicate]
For this object in javascript:
div =
{
id: (changeable value),
html = 'div id="divName'+id+'"></div>
}
This is the most basic form that I can present the problem.
I have a ...
0
votes
1
answer
46
views
JavaScript: Create Factory Function that Returns Object with Methods That Have Specific Properties
I have a factory function that returns an object. Within the object, I have a method called getNext.
I want the getNext method to return an object with the properties value and done.
Below is ...
5
votes
3
answers
3k
views
Why doesn't Object.getOwnPropertyNames() list all properties and methods?
I am trying to extract all the properties and methods from an object which happens to be a string: var str = "Hello World!"
If I use the command Object.getOwnPropertyNames(str) I get a list of ...
0
votes
1
answer
32
views
Properties/methods of simple object not working in javascript [duplicate]
I have a javascript code within an html file. My goal is to display the list properties and methods of a given object. This is the code:
<!DOCTYPE html>
<html lang="en">
<head>
&...
6
votes
1
answer
2k
views
How to check if object supports method in vba?
Is it possible to check whether an object supports a certain method without an error handler in VBA?
I've found numerous duplicates asking the question for for example JavaScript and Symphony2, but ...
1
vote
1
answer
52
views
How to I have a default object property and have the option of setting it?
I've been reading about setting object properties, but I was confused and haven't succeeded in attempts.
I want create a new object. i.e. Thissle = yt_video()
Then, if I run Thissle.url I want a ...