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
// Bonfire: Title Case a Sentence | |
// Author: @robertsheacole | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-title-case-a-sentence | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function titleCase(str) { | |
//make string lowercase and split into array | |
var makeArray = str.toLowerCase().split(' '); | |
//loop through array | |
for ( var i = 0; i < makeArray.length; i++){ |
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
(function () { | |
fetch('https://ipapi.co/json') | |
.then(promise => promise.json()) | |
.then(response => { | |
// Here is an example of using the client's location to run certain logic. | |
(response.country === "United States") ? console.log(response) : console.warn("not in US!")) | |
//Remove the line above this and add your code here...! | |
} | |
.catch(err => console.warn(err)) | |
})() |