Created
July 15, 2016 01:00
-
-
Save benstone1/48829266228ecf63bffafffaa8ea6183 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myWords = ["Hello!", "What", "is", "your", "name?", "Functions", "are", "cool!"] | |
var concatenateArray = function(arr){ | |
var str = "" | |
for (var i = 0; i < arr.length;i++){ | |
var currentString = arr[i] | |
str += currentString | |
str += " " | |
} | |
return "My string is: " + str | |
} | |
console.log( concatenateArray(myWords) ) | |
function findMax(inputArray){ | |
var currentMax = inputArray[0] | |
for (var i = 0;i < inputArray.length; i++ ){ | |
var currentNumber = inputArray[i] | |
if (currentNumber > currentMax){ | |
currentMax = currentNumber | |
} | |
} | |
return currentMax | |
} | |
console.log( findMax([3,9,2,45.23,-234,15,1,19,24542243]) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment