Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // QUESTION 1
- var combineArgs = function( a, b ){
- alert(a + b);
- };
- combineArgs("This question ", "is easy");
- // QUESTION 2
- var highOrLow = function( num, sayHigh, sayLow ){
- if( num > 5 )
- alert(sayHigh);
- else
- alert(sayLow);
- };
- // QUESTION 3
- highOrLow = function( num, sayHigh, sayLow ){
- if( num > 5 )
- return sayHigh;
- else
- return sayLow;
- };
- alert( highOrLow( 6, "High number", "Low number" ) );
- // QUESTION 4
- var x = function sayBoom(){
- alert("BOOM!");
- };
- x();
- // QUESTION 5
- var callFunction = function( fn ){
- // checking if argument is a function, otherwise this would error
- // not really needed as the question says to just assume it is a function
- if( typeof fn === "function" ){
- fn();
- }
- };
- callFunction( x );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement