Answer the question
In order to leave comments, you need to log in
How to create a static variable in ES6?
How to set a variable in a class.
static is not suggested.
SubList.style = {
overflow: 'hidden'
};
//Не работает
SubList.prototype.style = {
overflow: 'hidden'
};
Answer the question
In order to leave comments, you need to log in
No, ES6 doesn't have that. But in ES7 it is planned , babel supports it.
Can be defined in the constructor?
class SubList {
get style() {
return {
overflow: 'hidden'
};
}
}
var someObj = {
overflow: 'hidden'
};
export default class FooBar {
get someObj() {
return someObj;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question