Last active
December 2, 2015 01:28
-
-
Save robert-blankenship/dc1e656e5f649d3f76d9 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
function formatUrl(linkUrl) { | |
if (linkUrl[0] == "/") { | |
var append1 = "http://"; | |
var originalUrl = linkUrl; | |
var newUrl = linkUrl.replace("//", append1); // this doesn't actually change linkUrl | |
if (originalUrl !== newUrl) { | |
console.log("linkUrl: ", linkUrl); | |
console.log("originalUrl: ", originalUrl); | |
console.log("newUrl: ", newUrl); | |
} | |
return linkUrl; | |
} else { | |
return linkUrl; | |
} | |
}; | |
formatUrl("//google.com"); | |
formatUrl("http://google.com"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment