Category JavaScript

Posts that explain how to work with the JavaScript language.

How to use reserved characters in a URI

If you have to encode a reserved character (such as ‘/’ or ‘@’) so that it can be passed in a URI path, you may need to encode it twice: Example: const ticker = ‘@SMC/2018’, encodedTicker = encodeURIComponent(encodeURIComponent(ticker)), uri =…

Recursion Examples

Recursion in programming can be a mind bender.  Here are two examples of recursive functions coded in JavaScript.  These examples are dependent on lodash methods. Hopefully these code patterns are useful to you. I find them useful as starting points…

HTML Character Entities in Javascript

Sometimes you need to write html character entities in javascript, but html character entities can’t be used, because they don’t get interpreted by javascript. In javascript, you need to use the equivalent unicode character codes instead. HTML character entity, wrong:…