Skip to main content

All Questions

Tagged with
2 votes
4 answers
37 views

changing object values to matching mapped values

I have an Object that looks like this const companyObj = { Advice_Charge: "B. In service / product cost" Org_Advisory: "B. 1-3" Org_Developers: "A. ...
invrt's user avatar
  • 699
0 votes
0 answers
42 views

create dynamic class in ES6 [duplicate]

is that possible to extends the class without writing the current class name? example, I have class Animal like this class Animal { constructor(foot, livein) { this.foot = foot; ...
Zum Dummi's user avatar
  • 233
1 vote
0 answers
185 views

JavaScript ES6 tax calculations with some items being exempt

I am setting up a es6/oop tax calculator and having some issues setting the tax amount correctly. I am instantiating product objects with their quantity and price and adding them to an inventory and ...
Matt Larsuma's user avatar
  • 1,504
0 votes
1 answer
475 views

Convert an ES5 IIFE in ES6, OOP Javascript programming

I Need to refactor an IIFE in ES6. In ES6 let and const have a block scope, so I really need an IIFE in ES6? This is the ES5 version of the code: var oojs = (function(oojs) { var ...
ufollettu's user avatar
  • 842
4 votes
2 answers
1k views

Why use Export and Import?

This question is about ES6 not about global variables. When the new ES2015 export or export default were introduced. They were made so that you can import/get the same variables, values or items ...
Shariq Musharaf's user avatar
21 votes
5 answers
10k views

ES6 Classes - Updating Static Properties

I am trying to figure out alternative ways to set a static (or class) property an ES6 Class and then change it after new instances of the class are created. For example, lets say I have a class ...
Jared's user avatar
  • 651
0 votes
2 answers
75 views

Make assigning object properties less redundant when there's structural similarities in ES6

Let's say I'm assigning object properties as follows: d.x += d3.event.dx || 0; d.y += d3.event.dy || 0; In other words, there's consistency in how the properties are assigned values. Is there a ...
Union find's user avatar
  • 8,091
0 votes
1 answer
106 views

ES2015: Call Inner method from overwrited class

I am learning ES6 classes and object. In order to that I'm making a sample app, and I found this issue: I have this MainClass: class App { boot() { console.log('app booted') } } ...
Pablo's user avatar
  • 10.3k
86 votes
10 answers
121k views

How to create a derived class in JavaScript?

I have a base class: function Monster() { this.health = 100; } Monster.prototype.growl = function() { console.log("Grr!"); } That I want to extend and create another class with: function ...
Lucas Penney's user avatar
  • 2,664