JavaScript - Functions Lesson - 5. Return Step 2 STUCK



I have attempted many ways to accomplish this task within the Functions lesson of JavaScript Intro. I have done research as well. At this point I am hoping someone has a gracious heart to display the correct code and briefly explain why. I've written below all the info I have regarding the error to where I am stuck. Thank you.

Stuck Here
Learn JavaScript > 3. Functions > 5. Return > Instructions #2
(This post will not allow me to enter a functioning link.

2. Inside the takeOrder function, set orderCount equal to orderCount plus 1, so that each time the takeOrder function runs, 1 is added to the orderCount.

You can add one to the orderCount like so:

orderCount = orderCount + 1;

Error Message:
Oops! The test returned an error. Maybe you have a syntax error or a typo. See full error.

at Parser.pp.parseTopLevel (/usr/lib/node_modules/babel-register/node_modules/babylon/lib/parser/statement.js:36:8)
at Parser.parse (/usr/lib/node_modules/babel-register/node_modules/babylon/lib/parser/index.js:129:19)
at parse (/usr/lib/node_modules/babel-register/node_modules/babylon/lib/index.js:47:47)
at File.parse (/usr/lib/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/index.js:517:34)
at File.parseCode (/usr/lib/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/index.js:603:20)
at /usr/lib/node_modules/babel-register/node_modules/babel-core/lib/transformation/pipeline.js:49:12
at File.wrap (/usr/lib/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/index.js:563:16)
at Pipeline.transform (/usr/lib/node_modules/babel-register/node_modules/babel-core/lib/transformation/pipeline.js:47:17)
at Object.transformFileSync (/usr/lib/node_modules/babel-register/node_modules/babel-core/lib/api/node.js:144:10)
at compile (/usr/lib/node_modules/babel-register/lib/node.js:129:20)
at loader (/usr/lib/node_modules/babel-register/lib/node.js:158:14)
at Object.require.extensions.(anonymous function) as .js
at Module.load (module.js:356:32)
at Object.load (/usr/lib/node_modules/rewire/lib/moduleEnv.js:20:18)
at internalRewire (/usr/lib/node_modules/rewire/lib/rewire.js:57:15)
at rewire (/usr/lib/node_modules/rewire/lib/index.js:11:12)
at Object. (test.js:3:15)
at Module._compile (module.js:456:26)
at loader (/usr/lib/node_modules/babel-register/lib/node.js:158:5)
at Object.require.extensions.(anonymous function) as .js
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /usr/lib/node_modules/mocha/lib/mocha.js:220:27
at Array.forEach (native)
at Mocha.loadFiles (/usr/lib/node_modules/mocha/lib/mocha.js:217:14)
at (/usr/lib/node_modules/mocha/lib/mocha.js:469:10)
at Object. (/usr/lib/node_modules/mocha/bin/_mocha:404:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:945:3

var orderCount = 0;

function takeOrder(topping, crustType) orderCount = orderCount + 1; 

console.log( topping % crustType + 'Order: thin crust pizza topped with bacon');

  // Output: order pizza
  // Output: chesse with bread crust
  // Output: peppers with thin crust


You function syntax is a little off. A javascript function syntax is usually like this:

function randomName(parameter1, parameter2) {
    // put stuff in your function here


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.