Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJacky Chau
Full Stack JavaScript Techdegree Student 8,106 PointsHTML Entities
It is said that some characters are reserved in HTML, like ">" and "<" . So, instead of writing n>5 , we should write n>5
However, I tried writing n>5 and the browser could still show the ">" sign successfully. So, is character entity just unnecessary?
Thank you.
1 Answer
Steven Parker
231,261 PointsReserved characters might get printed correctly in some cases, but relying on them to print as they are will make your code "brittle" to future changes. Using the character entity guarantees proper display both now and after possible future page modifications and/or across different browsers.
Also, character entities begin with an ampersand ("&
") and end with a semicolon (";
"). So the correct sequence to display "n>5" would be "n>5
".
Jacky Chau
Full Stack JavaScript Techdegree Student 8,106 PointsJacky Chau
Full Stack JavaScript Techdegree Student 8,106 PointsI see. Thank you very much for your detailed reply.