Skip to content

Commit

Permalink
Day 42: OOps
Browse files Browse the repository at this point in the history
  • Loading branch information
uttu-316 committed Nov 28, 2022
1 parent 576a33b commit f987430
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
4 changes: 3 additions & 1 deletion javascript/Day41/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ var productList = [

function createCard(item) {
const link = document.createElement('a');
link.setAttribute('href',`/javascript/Day41/product.html?id=${item.id}`);
let {pathname} = location;
pathname = pathname.replace('index.html','product.html')
link.setAttribute('href',`${pathname}?id=${item.id}`);
link.classList.add("card");
link.setAttribute('data-id',item.id)
const card = document.createElement("article");
Expand Down
48 changes: 48 additions & 0 deletions javascript/Day42/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//constructor function
function Person(name,age,gender="Male"){
//properties
this.name =name;
this.age = age;
this.gender= gender;
}


//instantiating
const a = new Person("Utkars",24);
const b = new Person("Ahemad",22);
const c = new Person("Satyam",23);
const d = new Person("Lakhan",32);
const e = new Person("Sunidhi",22,"female");
//instance

console.log(a,b,c,d,e)
//Object


class Person{
constructor(name,age){
this.name = name;
this.age =age;
}
getName(){
console.log(this.name)
}
}


const person1 = new Person('Ram',23)
const person2 = new Person('Athira',21)

person2.getName();





person1.game = "Boxing"


person2.makeup = "nykaa";


console.log(person1,person2)

0 comments on commit f987430

Please sign in to comment.