<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aleksey Nagovitsyn</title>
    <description>The latest articles on DEV Community by Aleksey Nagovitsyn (@nag5000).</description>
    <link>https://dev.to/nag5000</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F214221%2Fc386f970-246e-4b84-adc8-14b1e91068ef.png</url>
      <title>DEV Community: Aleksey Nagovitsyn</title>
      <link>https://dev.to/nag5000</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nag5000"/>
    <language>en</language>
    <item>
      <title>Discover JSREPL.io – A JavaScript REPL &amp; Playground</title>
      <dc:creator>Aleksey Nagovitsyn</dc:creator>
      <pubDate>Mon, 28 Oct 2024 23:52:44 +0000</pubDate>
      <link>https://dev.to/nag5000/discover-jsreplio-a-javascript-repl-playground-4b9i</link>
      <guid>https://dev.to/nag5000/discover-jsreplio-a-javascript-repl-playground-4b9i</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;JavaScript, HTML and CSS individually, and the entire frontend, with its vast ecosystem of Web APIs and external libraries, can sometimes behave in unexpected ways. It's an area full of quirks, and even seasoned developers find themselves double-checking things that seem straightforward. Whether it's a forgotten method signature or a gap in the documentation, there's always something to verify or clarify.&lt;/p&gt;

&lt;p&gt;Throughout my career, I've bounced between various tools to test JavaScript snippets and experiment with HTML/CSS. Let's take a look at some of them briefly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Chrome DevTools
&lt;/h3&gt;

&lt;p&gt;Console in Chrome DevTools has long been my go-to for quick JavaScript tests. No matter what site I'm on, I can open DevTools and run a snippet on the spot. While AI can answer many questions today, I still find myself turning to &lt;a href="https://developer.mozilla.org" rel="noopener noreferrer"&gt;MDN&lt;/a&gt;, opening the DevTools Console, and verifying things firsthand.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fepvjujiykbkvpkgtcdi0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fepvjujiykbkvpkgtcdi0.png" alt="Chrome DevTools Console" width="800" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DevTools Console is perfect for simple, short JavaScript snippets. But when it comes to more extensive code or npm packages, I need something more suitable.&lt;/p&gt;

&lt;h3&gt;
  
  
  CodePen
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://codepen.io" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt; is a time-tested tool and it's pretty good for tinkering with HTML and CSS. However, I don't often use it for JavaScript because it lacks autocompletion and TypeScript type hints. While you can add external npm libraries, the absence of TypeScript IntelliSense makes it less appealing for JavaScript coding.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv24rqazp7rcsjzaa8czh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv24rqazp7rcsjzaa8czh.png" alt="CodePen" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  StackBlitz
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://stackblitz.com" rel="noopener noreferrer"&gt;StackBlitz&lt;/a&gt; is a powerhouse, offering a full-featured development environment right in a browser, thanks to WebContainers. It's my top choice for testing large JavaScript/TypeScript code fragments or anything involving npm packages. The editor provides TypeScript types, even for installed npm packages, just like in your IDE.&lt;/p&gt;

&lt;p&gt;While StackBlitz is incredibly powerful, it can sometimes feel like overkill for playing with simple things like formatting a date with &lt;code&gt;date-fns&lt;/code&gt;. It's a great tool, but you have to go through several steps: creating a project, waiting for the WebContainer to boot up, installing &lt;code&gt;date-fns&lt;/code&gt; dependency, removing default boilerplate, and finally writing the code you want to test.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpd2wsqj1jcuf4m5blluu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpd2wsqj1jcuf4m5blluu.png" alt="StackBlitz" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  RunJS
&lt;/h3&gt;

&lt;p&gt;Discovering &lt;a href="https://runjs.app" rel="noopener noreferrer"&gt;RunJS&lt;/a&gt; was a game-changer for me. I love how it displays the result of each expression right next to the code. This makes testing snippets incredibly productive without the constant need for &lt;code&gt;console.log&lt;/code&gt; or breakpoints.&lt;/p&gt;

&lt;p&gt;RunJS isn't open-source and offers limited features for free, but it was so useful that I bought a license without hesitation. However, RunJS has its limitations. For example, it is intended only for playing with JavaScript – it has no HTML/CSS input support, and there is no Preview window. Also, each JavaScript buffer is executed separately; you can't bundle them together using &lt;code&gt;import/export&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F467toos0qhsjjldk329r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F467toos0qhsjjldk329r.png" alt="RunJS" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  JSREPL.io
&lt;/h3&gt;

&lt;p&gt;One day, I found myself thinking how wonderful it would be to have good parts of the tools above combined together into a single tool:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;easily accessible and quick to use, just like Chrome DevTools,&lt;/li&gt;
&lt;li&gt;where you wouldn't need to clutter your code with &lt;code&gt;console.log&lt;/code&gt; statements, like RunJS,&lt;/li&gt;
&lt;li&gt;with TypeScript, JSX, HTML, CSS support and Preview window, like CodePen,&lt;/li&gt;
&lt;li&gt;with bundling and TypeScript IntelliSense, like StackBlitz.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I wished for a simple JS Playground but still handy and developer-friendly enough so I can copy-paste a snippet from MDN, StackOverflow, or npm package documentation, and watch it come to life instantly – whether it's JS, TS, JSX, HTML, CSS or all of it together.&lt;/p&gt;

&lt;p&gt;Also, I was working as a Vue developer at the moment, and I loved &lt;a href="https://play.vuejs.org" rel="noopener noreferrer"&gt;VueJS Playground&lt;/a&gt; for its simplicity and serverless nature, where you can start coding immediately without the hassle of logging in or waiting.&lt;/p&gt;

&lt;p&gt;Inspired by these ideas, I made &lt;a href="https://jsrepl.io" rel="noopener noreferrer"&gt;https://jsrepl.io&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;JSREPL is 99% serverless. The playground is powered by client-side JavaScript and WebAssembly. No login or registration is required. And you can still share your REPLs with others because the state is serialized right into the URL (yeah, I know, URLs feel bulky - this is a downside. I have plans to implement optional server-side saving).&lt;/p&gt;

&lt;h2&gt;
  
  
  Use cases
&lt;/h2&gt;

&lt;p&gt;Here are some ways you can use JSREPL.io.&lt;/p&gt;

&lt;h3&gt;
  
  
  Playing with JavaScript and Web APIs
&lt;/h3&gt;

&lt;p&gt;Test quirky JavaScript expressions like &lt;code&gt;[] + {}&lt;/code&gt;, &lt;code&gt;{} + []&lt;/code&gt;, or &lt;code&gt;NaN == NaN&lt;/code&gt;. While not practical for real projects, they can be fun to explore. More useful examples include experimenting with Promises, &lt;code&gt;Array.prototype.reduce&lt;/code&gt;, &lt;code&gt;String.prototype.replace&lt;/code&gt;, or Web APIs like &lt;code&gt;fetch&lt;/code&gt;, &lt;code&gt;File System API&lt;/code&gt;, or &lt;code&gt;Geolocation API&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5m3kxvb8xc3h0j92b269.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5m3kxvb8xc3h0j92b269.png" alt="JSREPL.io" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  TypeScript playground
&lt;/h3&gt;

&lt;p&gt;With Monaco editor's first-class TypeScript IntelliSense, you can explore TypeScript, check types and understand its workings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F58d98juslp4df0zrbcv1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F58d98juslp4df0zrbcv1.png" alt="JSREPL.io" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Classic HTML/CSS playground
&lt;/h3&gt;

&lt;p&gt;Use JSREPL to experiment with HTML and CSS and see how things look in the browser using the Preview window.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fktsx580coqvra74snrvq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fktsx580coqvra74snrvq.png" alt="JSREPL.io" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Universal JS/TS/HTML/CSS playground
&lt;/h3&gt;

&lt;p&gt;Powered by esbuild, JSREPL lets you use multiple JavaScript and TypeScript files as EcmaScript modules, cross-dependent on each other, attach them to HTML, and bundle everything together.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5wxbjfgyyrt1ncgsit9t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5wxbjfgyyrt1ncgsit9t.png" alt="JSREPL.io" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Using npm packages
&lt;/h3&gt;

&lt;p&gt;JSREPL allows you to use npm packages effortlessly, without any additional steps. This is very useful when you need to explore a package's API or experiment with its integration into your project. You'll automatically get TypeScript IntelliSense for imported npm packages if types are provided.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1eyg6mzeiafcd9bdlou5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1eyg6mzeiafcd9bdlou5.png" alt="JSREPL.io" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7rjwzjjihk49ip0qamx1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7rjwzjjihk49ip0qamx1.png" alt="JSREPL.io" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Tailwind CSS playground
&lt;/h3&gt;

&lt;p&gt;Tailwind CSS is supported out of the box. Simply write Tailwind CSS directives in your CSS files, and enjoy Tailwind CSS IntelliSense and autocompletion in the editor.&lt;/p&gt;

&lt;p&gt;JSREPL offers a full Tailwind CSS experience. You can define your own Tailwind config, use the &lt;code&gt;@apply&lt;/code&gt; directive, and the resulting CSS will only include used classes. Tailwind plugins are also supported, provided they're compatible with the browser environment.&lt;/p&gt;

&lt;p&gt;Note that Tailwind Preflight is disabled by default, but you can enable it if desired.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqv3gq8jzqmfwsxqdflwf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqv3gq8jzqmfwsxqdflwf.png" alt="JSREPL.io" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  React playground
&lt;/h3&gt;

&lt;p&gt;JSREPL supports React &amp;amp; JSX/TSX out of the box, with proper JSX IntelliSense and syntax highlighting in the editor.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzemfe29b68d3wr4pgsuh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzemfe29b68d3wr4pgsuh.png" alt="JSREPL.io" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The essence of &lt;a href="https://jsrepl.io" rel="noopener noreferrer"&gt;https://jsrepl.io&lt;/a&gt; is to offer a simple, but modern playground to play with JavaScript/TypeScript/HTML/CSS, enabling you to test your code snippets quickly and without distractions.&lt;/p&gt;

&lt;p&gt;While it's not a replacement for StackBlitz or your IDE, it can be a fantastic addition to your workflow.&lt;/p&gt;

&lt;p&gt;JSREPL is entirely free and open-source. You can check the source code on &lt;a href="https://github.com/jsrepl/jsrepl.io" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;JSREPL is in its early stages, and I am actively working on adding new features. Stay tuned for updates!&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
