Click here to Skip to main content
15,891,033 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: What's the best programming language to build this? Pin
Garth J Lancaster5-Nov-14 9:33
professionalGarth J Lancaster5-Nov-14 9:33 
AnswerRe: What's the best programming language to build this? Pin
Albert Holguin5-Nov-14 10:49
professionalAlbert Holguin5-Nov-14 10:49 
QuestionAngularJS Unit Test Pin
upkaar4-Nov-14 2:12
upkaar4-Nov-14 2:12 
AnswerRe: AngularJS Unit Test Pin
Richard MacCutchan4-Nov-14 2:19
mveRichard MacCutchan4-Nov-14 2:19 
GeneralRe: AngularJS Unit Test Pin
upkaar30-Jan-15 20:11
upkaar30-Jan-15 20:11 
GeneralRe: AngularJS Unit Test Pin
Richard MacCutchan30-Jan-15 21:46
mveRichard MacCutchan30-Jan-15 21:46 
AnswerRe: AngularJS Unit Test Pin
Simon_Whale4-Nov-14 3:06
Simon_Whale4-Nov-14 3:06 
Question2nd Javascript Assignment Pin
Member 1119456830-Oct-14 18:02
Member 1119456830-Oct-14 18:02 
This is my second and last assignment, any help is appreciated

PART 2


FUNCTION NAME

bonus


LANGUAGE

JavaScript


PARAMETERS

2 PARAMETERS


FUNCTION HEADER

function bonus (parameter1,parameter2) {


OBJECTIVE OF FUNCTION

Compute and return the total of all bonuses.



PARAMETERS

parameter1 = the minimum amount of sales for an employee to receive a bonus.

parameter2 = a percent used to calculate the bonus if employee gets a bonus.

Use both parameter values as is. Do not change them.



ARRAYS

There is an array named sales. It is the amount of sales each employee produced.

The array exists - do not create it.



WHAT TO DO

Examine each value in sales[]. You need a for(...) loop for this.

For each sales[] value that is at least the minimum amount of sales to get a bonus (parameter1) compute the bonus as: sales[] * percent used to calculate the bonus (parameter2).

Add each bonus to the total.

Return the total.

This is what I have so far,

C#
function bonus(parameter1,parameter2) {

     total = 0; // The total is at 0 right now.

     // I'm going to do the for loop here.

     for(i = 0; i <= parameter1; i++) {

          if (sales[i]=parameter1) {

               total = parameter2 + sales[i]; // The total is now total plus the bonus.

          };

     };

     return total; // I am returning the function total here.
};

AnswerRe: 2nd Javascript Assignment Pin
Kornfeld Eliyahu Peter30-Oct-14 20:10
professionalKornfeld Eliyahu Peter30-Oct-14 20:10 
QuestionRe: 2nd Javascript Assignment Pin
ZurdoDev5-Nov-14 8:54
professionalZurdoDev5-Nov-14 8:54 
AnswerRe: 2nd Javascript Assignment Pin
Afzaal Ahmad Zeeshan8-Nov-14 1:41
professionalAfzaal Ahmad Zeeshan8-Nov-14 1:41 
QuestionJavascript assignment Pin
Member 1119456830-Oct-14 18:00
Member 1119456830-Oct-14 18:00 
AnswerRe: Javascript assignment Pin
Kornfeld Eliyahu Peter30-Oct-14 20:08
professionalKornfeld Eliyahu Peter30-Oct-14 20:08 
QuestionRe: Javascript assignment Pin
ZurdoDev5-Nov-14 8:55
professionalZurdoDev5-Nov-14 8:55 
QuestionHow to get array value Pin
Nishant.Chauhan8028-Oct-14 19:11
Nishant.Chauhan8028-Oct-14 19:11 
GeneralRe: How to get array value Pin
jkirkerx29-Oct-14 12:11
professionaljkirkerx29-Oct-14 12:11 
QuestionSelect2 Newline is created when item is selected Pin
Sander123432127-Oct-14 3:31
Sander123432127-Oct-14 3:31 
QuestionClick function not working the first time Pin
KokDavy27-Oct-14 1:43
KokDavy27-Oct-14 1:43 
Questionjavascript certification study pal Pin
Member 1117229022-Oct-14 3:13
Member 1117229022-Oct-14 3:13 
QuestionJQGrid and MIT license Pin
Sibeesh KV9-Oct-14 19:20
professionalSibeesh KV9-Oct-14 19:20 
AnswerRe: JQGrid and MIT license Pin
Richard Deeming9-Oct-14 22:52
mveRichard Deeming9-Oct-14 22:52 
GeneralRe: JQGrid and MIT license Pin
Sibeesh KV12-Oct-14 23:40
professionalSibeesh KV12-Oct-14 23:40 
AnswerRe: JQGrid and MIT license Pin
Sunasara Imdadhusen12-Oct-14 23:32
professionalSunasara Imdadhusen12-Oct-14 23:32 
GeneralRe: JQGrid and MIT license Pin
Sibeesh KV12-Oct-14 23:40
professionalSibeesh KV12-Oct-14 23:40 
Questiondropdown edit type selection to read mode for few records. Pin
parkway9-Oct-14 7:06
parkway9-Oct-14 7:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.