Linked Questions

2 votes
6 answers
134 views

Code is from mozilla website function Product(name, price) { this.name = name; this.price = price; if (price < 0) throw RangeError('Cannot create product "' + name + '" with a negative ...
Sankara's user avatar
  • 1,489
0 votes
3 answers
442 views

function test() { var test_array = []; } var arrayList = new Array(); arrayList[0] = new test(); arrayList[0].test_array[0] = "test"; (try it out) I'm trying to create an array, initialize an ...
William Martin's user avatar
1 vote
2 answers
1k views

So before I always used this method of encapsulating my Javascript: Classtype = (function (){ //private members var variable1; var variable2; // //public methods return { ...
Dimo's user avatar
  • 3,300
1 vote
2 answers
618 views

I'm new to creating objects in JavaScript. I need to make a random number generator that doesn't repeat itself too often (I have not tried to implement that part in the code snippet below). How can I ...
user137717's user avatar
  • 2,205
1 vote
4 answers
614 views

I have an Object with a getter and setter where I'm intending to protect a property so that it can only be updated through a method. Let's call this object Person which has the following structure: ...
Paul Aldred-Bann's user avatar
2 votes
1 answer
549 views

class A { f1() { f2(); } f2() {} } var a = new A(); console.log(a.f1()); returns f2 is not defined. Whereas: { function f1() { return f2(); } function f2() { return 'f2'; ...
755's user avatar
  • 3,121
2 votes
1 answer
612 views

I am learning Vue.js and at the moment i am learning to interact with the css, i really would love to know why my code doesn't work, basicly i have a button, when i click that button, every 1 second (...
user avatar
-1 votes
1 answer
992 views

What do I want to achieve? I have an class called Looper. I want to give each object a name and an own looper. Results I expect Created Looper Object... one Created Looper Object... two one - 1 two ...
Ron van der Heijden's user avatar
2 votes
1 answer
957 views

I have a question.. please let me know.. import React, { Component } from "react"; class App extends Component { constructor(props) { super(props); } handleClick = () => { ...
김우동's user avatar
1 vote
2 answers
1k views

I have looked through many other answers of this question unable to find an answer. The issue seems to be that it isn't recognizing the World global in my game.js file. The html file is ordered ...
bezzoon's user avatar
  • 2,029
3 votes
3 answers
437 views

Systemname = { Question : { send: function() { console.log("send"); }, read: function() { console.log("read"); }, delete: function() { ...
roman's user avatar
  • 949
0 votes
5 answers
343 views

I am experimenting imitating OOP like behavior in JS. I am trying to have (private) variables: id and name in function Person. To this function I am passing arguments which are used to initialize (...
Mahesha999's user avatar
  • 25.3k
2 votes
3 answers
228 views

i'm trying to run my JS code in differend areas independently, so i wanted to create a class and found this article and my problem is, that I can't use functions, which are in my class in my class. ...
Minding's user avatar
  • 1,433
0 votes
3 answers
364 views

Trying to learn how to create a durable object with JavaScript, but as you can see from the example below one can easily access any of the Person instance's members - What am I doing wrong? function ...
user1809836's user avatar
0 votes
1 answer
640 views

I am using a jQuery plugin for creating classes. But I don't want my classes to be initialized unless I want them to. How can I prevent the following code from initializing, but be accessible if need ...
Trip's user avatar
  • 27.2k

15 30 50 per page
1
3 4
5
6 7
10