// let myobj={ // fname:"barath", // lname:"chandra", // display(){ // return // this.fname+" "+this.lname; // } // } // console.log(myobj.display()); //1) // console.log(a); // var a=10; // console.log(a); // a=40; // console.log(a); // let b=20; // console.log(b); // b=60; // console.log(b); // //console.log(c); // var c=20; // console.log(c); // c=30; // console.log(c); // var a=10; // var b="barath" // var istrue=true; // console.log(a+" "+b+" "+istrue); //2) // let calculator = function(a, b) { // a=Number (a); // b=Number (b); // console.log("Addition is : ",a+b); // console.log("Substraction is : ", a - b); // console.log("Multiplication is : ", a * b); // if(b !==0){ // console.log("Division is : ", a / b); // } // else{ // console.log("division is:divide by zero"); // } // } // let a = prompt("Enter the first number: "); // let b = prompt("Enter the second number: "); // calculator(a, b); //3) // let person = { // name: "barath", // age: 16, // greet() { // return "Hello " + this.name + " " + this.age; // }, // isAdult() { // return this.age >= 18; // } // }; // console.log(person.greet()); // console.log(person.isAdult()); // 4) // function Student(name, grade) { // this.name = name; // this.grade = grade; // this.study = function() { // console.log(this.name + " is studying"); // this.grade += 1; // }; // this.getGrade = function() { // return this.grade; // }; // } // const student1 = new Student("barath", 8); // const student2 = new Student("shankar", 9); // student1.study(); // student2.study(); // console.log(`${student1.name} grade:${student1.getGrade()}`); // console.log(`${student2.name} grade:${student2.getGrade()}`); //5) // let temperatureCalculator={ // tofahren(x){ // let temp=((x/5)*9)+32; // return temp; // }, // tocelsius(y){ // let temp=(y-32)*5/9; // return temp; // } // } // let x=prompt("Enter temperature in celsius"); // let y=prompt("Enter temperature in Fahrenheit"); // let temp1=temperatureCalculator.tofahren(x); // console.log(temp1); // let temp2=temperatureCalculator.tocelsius(y); // console.log(temp2); // 6) function Person(name,age){ this.name=name; this.age=age; this.details=function det(){ return `Name: ${this.name}, Age: ${this.age}` } } function Student(name,age,grade){ Person.call(this, name, age); this.grade=grade this.gradeDetails=function fgh(){ return ` ${this.name}is studying for grade ${this.grade}.` } } Student.prototype = Object.create(Person.prototype); Student.prototype.constructor = Student let st=new Student("siddu",20,"C") console.log(st.gradeDetails()) console.log(st) console.log(st.age) //8) // function Person(name) { // this.name = name; // } // Person.prototype.greet = function() { // console.log(`Hello, my name is ${this.name}`); // }; // const person1 = new Person('Alice'); // person1.greet(); // console.log(Person.prototype); // console.log(person1.__proto__); // console.log(person1.__proto__ === Person.prototype); //9) // class Rectangle { // constructor(width, height) { // this.width = width; // this.height = height; // } // area() { // return this.width * this.height; // } // } // const rectangle = new Rectangle(5, 10); // console.log("The area of the rectangle is:", rectangle.area()); //10)