let bio = "Wendy Harper \n Software Engineer - TCS \n 3 Years in Web development"
console.log(bio);
let bio1 = `Wendy Harper
Software Engineer - TCS
3 Years in Web development`;
console.log(bio1);
let person = {
fN: `Wendy`,
lN: `Harper`,
name: function() {
return `My name is ${this.fN} ${this.lN}`;
}
};
console.log(person.name());
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 ${this.userName} is registered`);
}
}
let usera = new User("Shrikrishna", "[email protected]", "abedc");
usera.register();
class Member extends User {
constructor(userName, email, password, memberPackage) {
super(userName, email, password);
this.memberPackage = memberPackage;
}
getPackage() {
console.log(`This user ${this.userName} is subscribed to ${this.memberPackage}`);
}
}
let mem = new Member("Shrikrishna", "[email protected]", "abedc", "Annual");
mem.register();
mem.getPackage();
let symbol1 = Symbol();
let symbol2 = Symbol();
console.log(symbol1 === symbol2); //false
var symb1 = Symbol.for('bar');
var symb2 = Symbol.for('bar');
symb1 === symb2;
// true, both are same
// false, as Symbol() creates new Symbol each time it is called
console.log(symb1 === symb2);
var sym1 = Symbol("desc");
// Local symbol
var sym2 = Symbol.for("desc");
// Global symbol
console.log(Symbol.keyFor(sym1));
// undefined
console.log(Symbol.keyFor(sym2));
// desc
// Defining symbol
let email = Symbol();
// Defining object "user"
let user = {
name: "praveen",
age: 30,
//Symbol as key in array
[email]: "[email protected]"
};
console.log(user[email]);
// [email protected]
//Accessing Object Symbols
//Iterating Object.keys() and Object.getOwnPropertyNames(), using for loop or methods, would list just...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.