✨ Earn college credits in Cybersecurity, JS, HTML, CSS and Python

🤑 Join the Treehouse affiliate program and earn 25% recurring commission!

New No-Code Track! 🚀start learning today!

🌟 Dreaming of a bright future? 🎓 Ask about the Treehouse Scholarship program! 🚀

✨ Earn college credits in Cybersecurity, JS, HTML, CSS and Python

🤑 Join the Treehouse affiliate program and earn 25% recurring commission!

  • Treehouse Logo
  • Plans
    Chevron
    • For Individuals
    • For Businesses
    • For Schools
    • For Libraries
    • For Military
  • Library
    Chevron
    • All Courses
    • Tracks
    • College Credit
  • Techdegree
    Chevron
    • Overview
    • Front End Development
    • Full Stack JavaScript
    • Data Analysis
    • UX Design
    • Python
  • Community
    Chevron
    • Code Adventures
    • Discord
    • Forum
    • Success Stories
    • Treehouse Links
    • 100 Days of Code
  • Resources
    Chevron
    • Career Toolbox
    • CodeForward
    • Free Treehouse Near Me
    • Jobs
    • Blog
    • Support
    • About
  • For Individuals For Businesses For Schools For Libraries For Military
  • All Courses Tracks College Credit
  • Overview Front End Web Development Full Stack JavaScript Python Development Data Analysis UX Design
  • Code Adventures Discord Forum Success Stories Treehouse Links 100 Days of Code
  • Career Toolbox CodeForward Free Treehouse Near Me Jobs Blog Support About
  • Sign In
  • Free Trial
Instagram Twitter Facebook YouTube LinkedIn
    • Newest
      • Newest
      • Active
      • Unanswered
      • Featured
    • All Topics
      • All Topics
      • • General Discussion
      • • AI
      • • Android
      • • APIs
      • • Coding for Kids
      • • College Credit
      • • Computer Science
      • • CSS
      • • Data Analysis
      • • Databases
      • • Design
      • • Development Tools
      • • Digital Literacy
      • • Game Development
      • • Go Language
      • • HTML
      • • Java
      • • JavaScript
      • • Learning Resources
      • • Machine Learning
      • • No-Code
      • • PHP
      • • Professional Growth
      • • Python
      • • Quality Assurance
      • • React
      • • Ruby
      • • Security
      • • Swift
    • Showing results for:
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution
    • Close
  • Billy Jones
    Billy Jones
    28,560 Points

    I am not sure what this does in this instance let token = new Token(i, this);

    Posted on Jun 16, 2021 by Billy Jones
    Billy Jones
    28,560 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • Kylie Soderblom
    Kylie Soderblom
    3,890 Points

    Note: Corrected version of Token constructor see here. Question about When creating a new Token obj. (i, this),

    Posted on May 27, 2021 by Kylie Soderblom
    Kylie Soderblom
    3,890 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    0 Answers

  • Patrick Eaton
    Patrick Eaton
    3,860 Points

    How does JavaScript know what Token represents in this scenario?

    Posted on Apr 26, 2021 by Patrick Eaton
    Patrick Eaton
    3,860 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • Daniel Cranney
    Daniel Cranney
    11,609 Points

    Why is 'this' passed to the new Token object inside of the for loop?

    Posted on Feb 4, 2021 by Daniel Cranney
    Daniel Cranney
    11,609 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    3 Answers

  • Manoj Gurung
    Manoj Gurung
    5,318 Points

    This is bad

    Posted on Nov 23, 2020 by Manoj Gurung
    Manoj Gurung
    5,318 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • Steve Fau
    Steve Fau
    5,622 Points

    Pushing new tokens to this.tokens

    Posted on Oct 25, 2020 by Steve Fau
    Steve Fau
    5,622 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • James Croxford
    James Croxford
    12,723 Points

    Clarification on the use of the 'this' keyword inside of createTokens()?

    Posted on Aug 1, 2020 by James Croxford
    James Croxford
    12,723 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    0 Answers

  • Brendan Moran
    Brendan Moran
    14,052 Points

    Where to use jsdoc: getters, setters, constructors? Or only on regular and static methods?

    Posted on Jul 29, 2020 by Brendan Moran
    Brendan Moran
    14,052 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    0 Answers

  • Murilo de Melo
    Murilo de Melo
    14,456 Points

    Why does the new Token in Player accepts 2 arguments, 'i' and 'this', if the token constructor has no parameters?

    Posted on Jul 17, 2020 by Murilo de Melo
    Murilo de Melo
    14,456 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • Tetsuya Yokoyama
    Tetsuya Yokoyama
    11,286 Points

    Is it possible to put "new Token(this, i)" directly into push()?

    Posted on May 21, 2020 by Tetsuya Yokoyama
    Tetsuya Yokoyama
    11,286 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • praveen
    praveen
    11,314 Points

    Question about `this` being passed as a parameter in the createTokens() method

    Posted on Mar 1, 2020 by praveen
    praveen
    11,314 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • mk37
    mk37
    10,271 Points

    why does she use class instead of constructor function?

    Posted on Dec 12, 2019 by mk37
    mk37
    10,271 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    2 Answers

  • Michael Cook
    seal-mask
    .a{fill-rule:evenodd;}techdegree seal-36
    Michael Cook
    Full Stack JavaScript Techdegree Graduate 28,975 Points

    Could this method not be shorter?

    Posted on Dec 1, 2019 by Michael Cook
    .a{fill-rule:evenodd;}techdegree seal-36
    Michael Cook
    Full Stack JavaScript Techdegree Graduate 28,975 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • fairest
    seal-mask
    .a{fill-rule:evenodd;}techdegree seal-36
    fairest
    Full Stack JavaScript Techdegree Graduate 19,303 Points

    Why use a token variable and not just push the i to the new array?

    Posted on Nov 13, 2019 by fairest
    .a{fill-rule:evenodd;}techdegree seal-36
    fairest
    Full Stack JavaScript Techdegree Graduate 19,303 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • YONGJIN KIM
    seal-mask
    .a{fill-rule:evenodd;}techdegree seal-36
    YONGJIN KIM
    Full Stack JavaScript Techdegree Graduate 20,287 Points

    The link in the teacher's note, Usejsdoc.org, seems to be down

    Posted on May 15, 2019 by YONGJIN KIM
    .a{fill-rule:evenodd;}techdegree seal-36
    YONGJIN KIM
    Full Stack JavaScript Techdegree Graduate 20,287 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    3 Answers

  • William Daugherty
    seal-mask
    .a{fill-rule:evenodd;}techdegree seal-36
    William Daugherty
    Full Stack JavaScript Techdegree Graduate 30,935 Points

    New link for JS Documentation writing?

    Posted on May 7, 2019 by William Daugherty
    .a{fill-rule:evenodd;}techdegree seal-36
    William Daugherty
    Full Stack JavaScript Techdegree Graduate 30,935 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • Sherial JAwed
    PLUS
    Sherial JAwed
    Courses Plus Student 15,355 Points

    Don't quite understand the createTokens method.

    Posted on Apr 17, 2019 by Sherial JAwed
    Sherial JAwed
    Courses Plus Student 15,355 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • Ashish S
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Ashish S
    Python Web Development Techdegree Student 938 Points

    Hard time understanding code

    Posted on Mar 13, 2019 by Ashish S
    .a{fill-rule:evenodd;}techdegree
    Ashish S
    Python Web Development Techdegree Student 938 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    2 Answers

  • Anthony Albertorio
    Anthony Albertorio
    22,624 Points

    Integer is not a data type in JavaScript. Number is the data Type.

    Posted on Feb 10, 2019 by Anthony Albertorio
    Anthony Albertorio
    22,624 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    0 Answers

  • Dennis C
    Dennis C
    5,010 Points

    ReferenceError: Token is not defined

    Posted on Dec 8, 2018 by Dennis C
    Dennis C
    5,010 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    2 Answers

  • Tegar Putra
    Tegar Putra
    5,820 Points

    Should i createToken = 21 ? if can't what exactly reason for this ? and what function num ?

    Posted on Nov 26, 2018 by Tegar Putra
    Tegar Putra
    5,820 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • Juan Francisco Andrade Álvarez
    Juan Francisco Andrade Álvarez
    23,997 Points

    Pushing a token into the tokens array

    Posted on Oct 30, 2018 by Juan Francisco Andrade Álvarez
    Juan Francisco Andrade Álvarez
    23,997 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • Chris Shaffer
    Chris Shaffer
    12,030 Points

    The for loop should probably use <= not < num.

    Posted on Oct 24, 2018 by Chris Shaffer
    Chris Shaffer
    12,030 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • arshia mohammadi
    arshia mohammadi
    7,657 Points

    I don't know what "this" is referred to in let tokens = new Token(i, this);

    Posted on Oct 4, 2018 by arshia mohammadi
    arshia mohammadi
    7,657 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    2 Answers

  • Gonzalo Torres del Fierro
    PLUS
    Gonzalo Torres del Fierro
    Courses Plus Student 16,751 Points

    createTokens(num)

    Posted on Sep 14, 2018 by Gonzalo Torres del Fierro
    Gonzalo Torres del Fierro
    Courses Plus Student 16,751 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

  • valeria cravea
    valeria cravea
    3,986 Points

    word this - function createTokens i dont understand what this is referred to ? let token = new Token(i,this);

    Posted on Sep 8, 2018 by valeria cravea
    valeria cravea
    3,986 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    2 Answers

  • Linus Johansson
    Linus Johansson
    12,469 Points

    Token not defined error in player class

    Posted on Sep 7, 2018 by Linus Johansson
    Linus Johansson
    12,469 Points
    • JavaScript
    • Object-Oriented JavaScript: Challenge
    • Building Constructor Methods and Generating Objects
    • createTokens() Method Solution

    1 Answer

Posting to the forum is only allowed for members with active accounts.
Please sign in or sign up to post.

    Treehouse

  • About
  • Blog
  • Careers
  • Community
  • Stories
  • Shop
  • Contact
  • Gift Card

See Full Catalogue

Techdegree

  • Front End Web Development
  • Full Stack JavaScript
  • Python Development
  • Data Analysis
  • UX Design

Tracks

  • Learn to Code for Beginners
  • Beginning Python
  • Beginning SQL
  • Beginning Java
  • ...see more

Courses

  • JavaScript Basics
  • Intro to HTML & CSS
  • Python Basics
  • CSS Layout
  • ...see more

Explore

  • Plans
  • Affiliates
  • Perks
  • Free Treehouse Near Me
  • Treehouse for Libraries
  • Treehouse for Businesses
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
  • Instagram
Terms & Conditions | Privacy

© 2025 Treehouse Island, Inc.