Last active
November 22, 2015 04:01
-
-
Save minsooshin/54ce473934578c550df8 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/minsooshin 's solution for Bonfire: Convert HTML Entities
This file contains hidden or 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: Convert HTML Entities | |
// Author: @minsooshin | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-convert-html-entities | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function convert(str) { | |
// :) | |
return str.replace(/&/g, '&') | |
.replace(/</g, '<') | |
.replace(/>/g, '>') | |
.replace(/"/g, '"') | |
.replace(/'/g, '''); | |
} | |
convert("Dolce & Gabbana"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment