Created
September 27, 2015 04:19
-
-
Save CharlesAMoss/090f5cdb53e5a37cb121 to your computer and use it in GitHub Desktop.
these are the jokes
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 x = "great sadness"; | |
var great_magic = function ( str ) { | |
var result = str.replace(new RegExp(("\\b" + "sadness" + "\\b"), 'g'), "happiness"); | |
return result; | |
}; | |
console.log(great_magic(x)); // logs "great happiness" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment