Jump to content

Need help with JavaScript program

steVENOM
Go to solution Solved by vorticalbox,


const add = (a, b) => a+b

 

Not using es6....

Hi! I'm in need of some help with my JavaScript work for programming. I need to make a program that adds 2 parameters together as a function and returns them. The problem I'm having is that its a function and I'm still learning how to properly execute functions. Here is the question being asked by my instructor followed by my current progress.

 

Question: *in the image*

My answer: 

//add function - adds two numbers together

var add = function( operand1, operand2) {

  var sum = (operand1 + operand2);
return sum;
 

}

//Now add two test cases that will call the add function with different parameters.

add(10,10);

 

Screenshot (1).png

Here are my specs:

  • CPU: Intel - Core i7-8700K 6-Core Processor OC @ 5.0ghz
  • Cooler: Cooler Master - Hyper 212 EVO 82.9 CFM Sleeve Bearing CPU Cooler
  • Motherboard: Asus - Prime Z370-A ATX LGA1151 Motherboard
  • Storage: Western Digital - WD Blue 1TB 2.5" 5400RPM Internal Hard Drive
    • Samsung - 850 EVO-Series 250GB 2.5" Solid State Drive
    • WD 4TB Black - Passport
  • RAM: Corsair Vengence RGB 2x8 RAM
  • Graphics Card: MSI - GeForce GTX 1080 Ti 11GB Founders Edition Video Card
  • Case: Corsair Crystal 460x
  • Power Supply: Corsair - CXM 650W 80+ Bronze Certified Semi-Modular ATX Power Supply
  • Operating System: Microsoft - Windows 10 Home OEM 64-bit
  • Monitor: Dell - S2417DG 23.8" 2560x1440 165Hz Monitor
  • Keyboard: Corsair K70 Mk II
  • Mouse: Corsair - SCIMITAR PRO RGB Wired Optical Mouse
  • Headphones: Bose QC 35 II - Active Noise Cancelling Headphones
     
Link to comment
Share on other sites

Link to post
Share on other sites


const add = (a, b) => a+b

 

Not using es6....

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×