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

Friday, December 7, 2012

LearnStreet Javascript Lesson 7 Exercise 3



//sample solution
function firstAndLast(arr) {
    //your code here
    var firstElement = arr[0];
    var lastElement = arr[arr.length-1];
    if(firstElement===lastElement){
        return true;
    } else {
        return false;
    }
}
//test
firstAndLast([1,2,3,4,1]);

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts