Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Foundations Functions Return Values

Manjula Kashyap
Manjula Kashyap
2,694 Points

Return value

I not able to see the return value at the console. I am using Google Chrome. There are no errors. But I just can't see the return value.

index.html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>JavaScript Foundations: Functions</title>
    <style>
      html {
        background: #FAFAFA;
        font-family: sans-serif;
      }
    </style>
  </head>
  <body>
    <h1>JavaScript Foundations</h1>
    <h2>Functions: Return Values</h2>
    <script>
      function arrayCounter(myArray) {
        if ((typeof myArray === 'undefined') ||(typeof myArray === 'number') || 
(typeof myArray === 'string')){
              return 0;
        }

        return myArray.length;
        }


    </script>
  </body>
</html>

1 Answer

It looks like you need to add a console.log() to your script, and add the function in the log. I hope this helps.