Quotes help make search much faster. Example: "Practice Makes Perfect"

Friday, December 7, 2012

LearnStreet Javascript Lesson 5 Exercise 5


//sample solution

function find42(a, b) {
    //Code the function body below.
    var sum = a + b;
    var difference = Math.abs(a-b);
    if(a===42 || b===42 || sum===42 || difference===42){
        return true;
    } else {
        return false;
    }
}
//test
find42(1,43);

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts