Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // function Student(name, age) {
- // this.name = name
- // this.age = age
- // this.b = 55
- // this.intro = intro()
- // function intro(){
- // function nested () {
- // console.log(this);
- // console.log(`My name is ${this.name} and I am ${this.age} years old`);
- // }
- // return nested
- // }
- // }
- // const studentOne = new Student("shopnil", 25)
- // studentOne.intro()
- // function Student(name, age){
- // //let this = Object(null)
- // this.name = name,
- // this.age = age
- // this.intro = intro
- // function intro(){
- // function nested (){
- // function nesterTwo () {
- // function nestedThree (){
- // this.name = "linkon"
- // function nestedFour (){
- // console.log(`My name is ${this.name} I am ${this.age} years old`);
- // }
- // return nestedFour
- // }
- // return nestedThree
- // }
- // return nesterTwo
- // }
- // return nested
- // }
- // }
- // var shopnil = new Student("shopnil", "age")
- // shopnil.intro()()()()()
- // shopnil.intro().nested()()()()
- // function funcOne (name, age){
- // function nestedOne(){
- // function nestedTwo(){
- // return{
- // name: name,
- // age: age,
- // intro: function (){
- // this.name = "shopnil"
- // function nestedOne () {
- // function nestedTwo () {
- // console.log(`My name is ${this.name} I am ${this.age} years old`);
- // }
- // return nestedTwo
- // }
- // return {nestedOne, name: "sidrat"} //this
- // }
- // }
- // }
- // return nestedTwo
- // }
- // return nestedOne
- // }
- // let obj = new funcOne("shopnil", 25)
- // // console.log(obj()().name);
- // obj()().intro().nestedOne()()
- // console.log(obj()().intro());
- // class Student{
- // //let this = createObject(null)
- // constructor(name, age){
- // this.name = name,
- // this.age = age
- // }
- // intro(){
- // const nestedFunction = () => {
- // const nestedTwo = () => {
- // console.log(`My name is ${this.name} I am years old`);
- // }
- // return nestedTwo
- // }
- // return nestedFunction
- // }
- // }
- // const shopnil = new Student("shopnil", 25)
- // shopnil.intro()()()
- function Student(name, age){
- //let this = Object(null)
- this.name = name,
- this.age = age
- this.intro = intro
- function intro(){
- const nested = () => {
- const nesterTwo = () => {
- const nestedThree = () => {
- const nestedFour = () => {
- console.log(`My name is ${this.name} I am ${this.age} years old`);
- }
- return nestedFour
- }
- return nestedThree
- }
- return nesterTwo
- }
- return nested
- }
- }
- var shopnil = new Student("shopnil", 25)
- shopnil.intro()()()()()
- var obj = {
- name: "shopnil",
- age: 25,
- intro(){
- function introNestedOne(){
- function introNestedTwo () {
- console.log(`My name is ${this.name} I am ${this.age} years old`);
- }
- return introNestedTwo
- }
- return {introNestedOne: introNestedOne, name: "Ridom"}
- }
- }
- // obj.intro()()()
- obj.intro().introNestedOne()()
- var obj = {
- name: "shopnil",
- age: 25,
- intro(){
- const introNestedOne = () => {
- console.log(`My name is ${this.name} I am ${this.age} years old`);
- }
- return {introNestedOne: introNestedOne, name: "Ridom"}
- }
- }
- obj.intro().introNestedOne()
- var obj = {
- name: "shopnil",
- age: 25,
- intro: function (){
- const nestedOne = () => {
- console.log(`My name ${this.name} I am ${this.age} years old`);
- }
- return nestedOne()
- }
- }
- obj.intro()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement