Skip to main content

Notice: Workspaces are undergoing maintenance and are temporarily unavailable.

🚀 In our NEW AI Bootcamp you'll build a working app in 28 days, no experience required. Free to all subscription levels.

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

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

  • Treehouse Logo
    • For Individuals
    • For Businesses
    • For Schools
    • For Libraries
    • For Military
    • All Courses
    • Tracks
    • AI Bootcamp
    • College Credit
    • Techdegree Bootcamps
    • Front End Development
    • Full Stack JavaScript
    • Code Adventures
    • Discord
    • Forum
    • Success Stories
    • Treehouse Links
    • 100 Days of Code
    • Explore
    • Career Toolbox
    • Free Treehouse Near Me
    • Affiliates
    • Blog
    • Support
    • About
    • Learn
    • Beginner's Guide to Coding
    • Data Analysis with SQL & Python
    • Front-End Web Development
    • Python Programming Basics
    • Techdegree Bootcamp Overview
    • UX Design Fundamentals
    • AI Tools for Beginners
  • For Individuals For Businesses For Schools For Libraries For Military
  • All Courses Tracks AI Bootcamp College Credit
  • Techdegree Bootcamps Front End Web Development Full Stack JavaScript
  • Code Adventures Discord Forum Success Stories Treehouse Links 100 Days of Code
  • Explore Career Toolbox Free Treehouse Near Me Affiliates Blog Support About
    Learn Beginner's Guide to Coding Data Analysis with SQL & Python Front-End Web Development Python Programming Basics Techdegree Bootcamp Overview UX Design Fundamentals AI Tools for Beginners
  • Sign In
  • Free Trial
Instagram Twitter Facebook YouTube LinkedIn
Loading banner... Start your free trial at Treehouse
    • Newest
      • Newest
      • Active
      • Unanswered
      • Featured
    • All Topics
      • All Topics
      • • General Discussion
      • • AI
      • • 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
      • • Vibe Coding
  • Billy Jones
    Billy Jones
    28,560 Points

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

    Posted June 16, 2021 12:49am 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 May 27, 2021 2:18am 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 April 26, 2021 3:02pm 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 February 4, 2021 3:23pm 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 November 23, 2020 2:26am 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 October 25, 2020 2:23pm 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 August 1, 2020 12:28am 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 July 29, 2020 11:40pm 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 July 17, 2020 10:46pm 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 May 21, 2020 2:41pm 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 March 1, 2020 3:22am 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 December 12, 2019 8:36am 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 December 1, 2019 9:01pm 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 November 13, 2019 5:16pm 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 May 15, 2019 4:31am 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 May 7, 2019 12:50am 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 April 17, 2019 1:18pm 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 March 13, 2019 4:02am 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 February 10, 2019 3:26am 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 December 8, 2018 5:38pm 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 November 26, 2018 1:57am 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 October 30, 2018 1:52am 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 October 24, 2018 11:50pm 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 October 4, 2018 1:32pm 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 September 14, 2018 12:28am 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 September 8, 2018 9:18am 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 September 7, 2018 3:25pm 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.

Techdegree

  • Front End Web Development
  • Full Stack JavaScript
SEE ALL

Tracks

  • Learn to Code for Beginners
  • Beginning Python
  • Beginning SQL
  • Beginning Java
SEE ALL

Courses

  • JavaScript Basics
  • Intro to HTML & CSS
  • Python Basics
  • CSS Layout
SEE ALL

About Us

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

Explore

  • Plans
  • Affiliates
  • Perks
  • Shop
  • Free Treehouse Near Me
  • Treehouse for Libraries
  • Treehouse for Businesses

Treehouse is an online technology education platform founded in 2011. Treehouse offers more than 700 self-paced, video-based courses in web development, programming, data analysis, design, and AI, plus two project-based bootcamp programs in Front End Web Development and Full Stack JavaScript. Individual Treehouse plans start at $25 per month and include a 7-day free trial. Treehouse serves individual learners, businesses, schools, and public libraries. Cardholders at participating U.S. public libraries can use Treehouse for free. Select Treehouse courses, offered with University Pathways International, are recommended for college credit by ACE and NCCRS. Treehouse learners earn digital certificates for completed Tracks.

Terms & Conditions · Privacy · © 2026 Treehouse Island, Inc.
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
  • Instagram
  • Discord