mathiasbynens/jsesc: Given some data, jsesc returns the shortest possible stringified & ASCII-safe representation of that data.

13-Dec-2024 20
Given some data, jsesc returns a stringified representation of that data. jsesc is similar to JSON.stringify() except: it outputs JavaScript instead of JSON by default, enabling support for data structures like ES6 maps and sets; it offers many options to customize the output; its output is ASCII-safe by default, thanks to its use of escape sequences where needed. For any input, jsesc generates the shortest possible valid printable-ASCII-only output. Here’s an online demo.
Use coupon code:

JAVASCRIPT

to get 40% discount on our 'The JavaScript Interview Bible' book!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle