Skip to main content

🚀 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
  • Rouchen Sun
    Rouchen Sun
    1,834 Points

    Uncaught ReferenceError: createListItems is not defined

    Posted December 16, 2023 5:48pm by Rouchen Sun
    Rouchen Sun
    1,834 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • Claire Kao
    Claire Kao
    4,393 Points

    Declaring variable outside of the function

    Posted December 13, 2023 2:45am by Claire Kao
    Claire Kao
    4,393 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • Genesis Mukassa
    Genesis Mukassa
    1,728 Points

    createListItems is not defined

    Posted November 14, 2023 1:58pm by Genesis Mukassa
    Genesis Mukassa
    1,728 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    2 Answers

  • Kristine Zakaite
    Kristine Zakaite
    2,236 Points

    "My music playlist" title shows much smaller and not centered.

    Posted February 6, 2023 1:24pm by Kristine Zakaite
    Kristine Zakaite
    2,236 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    2 Answers

  • n r
    n r
    7,665 Points

    "items is not defined at createListItems"

    Posted February 2, 2023 2:17am by n r
    n r
    7,665 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • Peter Huang
    Peter Huang
    5,427 Points

    do we need to use function to create a " li " to pass in the array?

    Posted November 27, 2022 1:52am by Peter Huang
    Peter Huang
    5,427 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    2 Answers

  • Geovani Mejia
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Geovani Mejia
    Front End Web Development Techdegree Student 7,940 Points

    I am confused why we are using function?

    Posted April 6, 2022 10:43pm by Geovani Mejia
    .a{fill-rule:evenodd;}techdegree
    Geovani Mejia
    Front End Web Development Techdegree Student 7,940 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    2 Answers

  • cameron williams
    cameron williams
    1,819 Points

    result '' after function. += wont work

    Posted February 24, 2022 8:54pm by cameron williams
    cameron williams
    1,819 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • Keith Grimes
    Keith Grimes
    10,362 Points

    List is not stacked, just one long string.

    Posted January 8, 2022 11:20pm by Keith Grimes
    Keith Grimes
    10,362 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • karan Badhwar
    seal-mask
    .a{fill-rule:evenodd;}techdegree seal-36
    karan Badhwar
    Web Development Techdegree Graduate 18,136 Points

    empty String

    Posted December 7, 2021 3:44am by karan Badhwar
    .a{fill-rule:evenodd;}techdegree seal-36
    karan Badhwar
    Web Development Techdegree Graduate 18,136 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • AHARON YOSEF
    AHARON YOSEF
    2,413 Points

    My playlist threw an error when I added a song

    Posted December 3, 2021 1:30am by AHARON YOSEF
    AHARON YOSEF
    2,413 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • Alex Godfrey
    Alex Godfrey
    9,249 Points

    Every other list item is a blank line (I have 12 lines instead of 6)... help!

    Posted October 20, 2021 3:23pm by Alex Godfrey
    Alex Godfrey
    9,249 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • Esther AlQaisi
    Esther AlQaisi
    2,311 Points

    Why is "return items" outside of the for loop?

    Posted May 3, 2021 11:35am by Esther AlQaisi
    Esther AlQaisi
    2,311 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • Hanwen Zhang
    Hanwen Zhang
    20,084 Points

    Why items = ''? why it starts emptyy?

    Posted March 27, 2021 11:02pm by Hanwen Zhang
    Hanwen Zhang
    20,084 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    2 Answers

  • Hanwen Zhang
    Hanwen Zhang
    20,084 Points

    Do we only name the parameter as "arr"? How do the loop know that "arr" is referred to the array we assigned to ?

    Posted March 27, 2021 11:00pm by Hanwen Zhang
    Hanwen Zhang
    20,084 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • Tyson Denis
    seal-mask
    PLUS
    .a{fill-rule:evenodd;}techdegree seal-36
    Tyson Denis
    Front End Web Development Techdegree Graduate 15,805 Points

    arr is undefined

    Posted February 19, 2021 7:49pm by Tyson Denis
    .a{fill-rule:evenodd;}techdegree seal-36
    Tyson Denis
    Front End Web Development Techdegree Graduate 15,805 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • ja5on
    ja5on
    10,339 Points

    argument

    Posted January 17, 2021 8:10pm by ja5on
    ja5on
    10,339 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    12 Answers

  • ja5on
    ja5on
    10,339 Points

    for loop problem

    Posted December 8, 2020 12:03pm by ja5on
    ja5on
    10,339 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • Carl Mclamb
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Carl Mclamb
    Full Stack JavaScript Techdegree Student 3,516 Points

    The list won't show

    Posted November 2, 2020 2:32am by Carl Mclamb
    .a{fill-rule:evenodd;}techdegree
    Carl Mclamb
    Full Stack JavaScript Techdegree Student 3,516 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • Rachael Zordan
    Rachael Zordan
    1,379 Points

    Why was 'arr' used to pass the array to the function when the array name is 'playlist'?

    Posted September 24, 2020 10:37pm by Rachael Zordan
    Rachael Zordan
    1,379 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    3 Answers

  • Manoj Gurung
    Manoj Gurung
    5,318 Points

    few question = what is arr ? Should we learn html before learning this.

    Posted September 20, 2020 7:47pm by Manoj Gurung
    Manoj Gurung
    5,318 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • Gerald Susanteo
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Gerald Susanteo
    Front End Web Development Techdegree Student 7,117 Points

    What is the empty strings for?

    Posted September 19, 2020 6:12am by Gerald Susanteo
    .a{fill-rule:evenodd;}techdegree
    Gerald Susanteo
    Front End Web Development Techdegree Student 7,117 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • Tabish Kazi
    Tabish Kazi
    5,951 Points

    Why do we have to use an empty string while declaring the variable 'items' first?

    Posted August 31, 2020 4:40pm by Tabish Kazi
    Tabish Kazi
    5,951 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    1 Answer

  • Jelena Feliciano
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Jelena Feliciano
    Full Stack JavaScript Techdegree Student 12,729 Points

    Trying to understand why nothing is showing on the console like the teachers example.

    Posted July 16, 2020 3:15pm by Jelena Feliciano
    .a{fill-rule:evenodd;}techdegree
    Jelena Feliciano
    Full Stack JavaScript Techdegree Student 12,729 Points
    • JavaScript
    • JavaScript Arrays
    • Loop Through Arrays
    • Loop Through an Array

    2 Answers

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