javascript Javascript es6 / es2015
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Javascript es6 / es2015相关的知识,希望对你有一定的参考价值。
/* CLASS */
class User {
}
/* FUNCTIONS / METHOD */
register () {
console.log('User Registered...');
}
/* CLASS AND METHOD EXAMPLES */
class User {
constructor(username, email, password) {
this.username = username;
this.email = email;
this.password = password;
}
static countUsers() {
console.log('There are 50 users');
}
register() {
console.log(this.username + ' is Registered')
}
}
let John = new User('John', 'John@hotmail.com', '1234'); // Creating new user John
John.register(); // Calling register method
User.countUsers(); // Calling countUsers method
John.register(); // calling method register
以上是关于javascript Javascript es6 / es2015的主要内容,如果未能解决你的问题,请参考以下文章
前端开发技能 —— JavaScript / ES6
什么是ES6?
javascript 获取字母数组javascript ES6
javascript Javascript es6 / es2015
javascript JavaScript模块ES6(ES2015)
javascript String utils javascript ES6