Skip to content

Instantly share code, notes, and snippets.

View shahab570's full-sized avatar

MD SHAHAB UDDIN shahab570

View GitHub Profile
@shahab570
shahab570 / a
Created January 10, 2021 10:00
const eat = () => {
console.log("Men cat eat");
};
const eat = () => {
console.log("Women cat eat");
};
eat(); //Uncaught SyntaxError: Identifier 'eat' has already been declared
@shahab570
shahab570 / d
Created January 10, 2021 05:17
(function() {
const run = () => {
console.log("He is running")
};
color:"black"
})();
@shahab570
shahab570 / d
Created January 10, 2021 05:15
{
color: "black";
const eat = () => {
console.log("eat with ");
};
const sleep = () => {
console.log("Sleep");
};
}
@shahab570
shahab570 / d
Last active January 10, 2021 05:13
const men = {
hairColor: "Black, White, Brown",
eat: function () {
console.log("Men can eat");
},
sleep: function () {
console.log("Men can sleep");
},
};
class Person {
constructor(name) {
this.name = name; // this is the data section
}
getName() { // this is the method
console.log("My name is " + this.name);
}
}
class Person {
constructor(name) {
this.name = name;
}
sayHi() {
console.log("Hi I am", this.name, " I am a human");
}
}
class Robot extends Person {
constructor(name) {
@shahab570
shahab570 / ds
Last active January 7, 2021 14:09
class Person {
constructor(name, gender) {
this.name = name;
this.gender = gender;
}
getGender() {
return this.gender;
}
}
class Programmer extends Person {
@shahab570
shahab570 / asf
Last active January 7, 2021 13:58
class Person {
//constructor is used to create and initialize obects created with class
//there can be only one construcotor inside a class
constructor(name, gender) {
this.name = name;
this.gender = gender;
}
getName() { // getName() is method definitons of the class
return this.name;
}
var person = {
firstName: "John",
lastName: "Smith",
phone: 88952133,
hobby: {
reading: [nove, stroy],
playing: [cricket, football],
},
};
function Player(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
var messi = new Player("Leonel", "messi");
var Pique = new Player("Gerard", "Pique");
var Team = {
Name: "Barcelona",