Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8853855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:44:59+00:00 2026-06-14T13:44:59+00:00

I took an AP computer science course a few years ago, I learned Java

  • 0

I took an AP computer science course a few years ago, I learned Java from it. I’m trying this Codeacademy now and I’m puzzled by this one question, can anyone explain this to me?
Here is the question:

You are a creature of habit. Every week you buy 5 oranges. But orange prices keep changing!

  1. You want to declare a function that calculates the cost of buying 5 oranges.
  2. You then want to calculate the cost of the 5 all together.
  3. Write a function that does this called orangeCost().
  4. It should take a parameter that is the cost of an orange, and multiply it by 5.
  5. It should log the result of the multiplication to the console.
  6. Call the function where oranges each cost 5 dollars.

Here’s my code:

var getCost = orangeCost (costOfOrange) {
    console.log(costOfOrange * 5);
};
getCost(5);

I believe it follows the syntax showed in earlier problems, but I’m getting this output:

SyntaxError: missing  before statement
Oops, try again. 
It looks like your syntax isn't quite right. 
Feel free to peek back at earlier exercises if you need help!
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:45:00+00:00Added an answer on June 14, 2026 at 1:45 pm

    Function definition in JavaScript can take one of two major forms:

    function funcName(param1, param2, ...) { }
    

    Or

    funcName = function(param1, param2, ...) { }
    

    Your example doesn’t follow either. You probably want:

    orangeCost = function(costOfOrange) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This semester, I took a course in computer graphics at my University. At the
I took a computer graphics course (graduate level) this past year. We spent the
I took a Computer Graphics exam a couple of days ago which had extra
I took 2 images with a cross point and now I'm trying to compare
I took Computer Architecture course and I understood that processor has 32 registers each
These days I have took Peter Norvig's Udacity course CS212: DESIGN OF COMPUTER PROGRAMS.
This past semester I took intro to object oriented programming in java and next
Alright, so I just took an introductory class into Computer Science and the school's
I took the rendered page from the SWT Browser and exported it to an
I took the example code from the Kendo UI demos at http://demos.kendoui.com/web/grid/remote-data.html , binding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.