loading...

Code to go: helping you find updated snippets for common use cases

jadjoubran profile image Jad Joubran ・2 min read

Code to go is a website that aims to help developers learning JavaScript find up to date, accurate and ready to use snippets of JavaScript for common use cases.

homepage screenshot

The motivation behind Code to go is that if you're teaching somebody JavaScript in 2017, they will most likely search on google some simple questions, such as:

How to split a string into array of characters in JavaScript

However, this search result will yield a Stackoverflow question that was asked 7 years ago, marked as duplicate and that has an accepted answer that recommends using split('').

While it may not be a big deal to use split('') here, the learner will immediately lose their confidence of finding the correct answer here, as the comments clearly state that they should not be using split('').

I realized that there's a gap that stackoverflow isn't able to fill, which is providing short snippets of code that are ready to be used, especially by beginners.

And this is exactly what Code to go does.

how to split a string into array of characters in JavaScript

Answers presented on Code to go are most of the times self-sufficient. They can be understood easily and they represent generic scenarios which allows the developers to adapt those snippets to their own scenarios.

search

At the time of writing, Code to go has 50 use cases that you can browser or search for.

We are planning on adding more, however our top priority is to maintain quality rather than quantity.

You can also suggest a Use case if you couldn't find it on the website. You can simply click on the Contribute button or head over to the github repository and create a new issue.

It's also important to mention that Code to go does not aim to replace documentation. Whenever possible, our answers link back to the official Mozilla Developer Network documentation like in this example below.
This allows the answers to be easily absorbed by beginners while also letting them dive deeper into the documentation.

example with MDN

I hope you this makes learning javascript even more enjoyable!

Posted on Sep 6 '18 by:

jadjoubran profile

Jad Joubran

@jadjoubran

Google developer expert in Web Technologies & Web Consultant. Try my interactive courses https://learnjavascript.online & https://react-tutorial.app

Discussion

markdown guide
 

I made a (small!) version of something just like this for my final project this semester for PHP! It pulled in the whole PHP documentation and linked to it live as you typed by function, and you could cross-reference by tags and functions/methods. I had started it originally for storing my own snippets and also to track errors as I went, so I could see how I had fixed things before or what errors I kept making over and over. I had hoped to get it working for HTML, CSS, and JavaScript too, and actually have the tables and everything built for them from scraping off of MDN etc., but the JavaScript docs were giving me too much grief.

I love it! And the idea (obviously :))

 

Nice! So then in your solution you don't curate the answers right?
Because I find myself researching before coming up with an answer to the use cases

 

Yeah, no curation. My idea longterm was to do an upvote/downvote thing similar to Stack Overflow but never got around to it!

 

Very nice idea. I look forward to seeing more. Might be cool to have categories for the use cases.

 

Thanks Lars! I'm glad you like it
We're planning categorization soon! Even maybe add a beginner-friendly label

 

Great! Maybe also something like a 'Copy to clipboard' shortcut.

this one is still under consideration as from a learning perspective, having a Copy to clipboard button will push people to think about copying the source code before understanding it

 

Love it! Great idea. A lot of languages have this issue, especially those with a longer history and where there's no one way to do things.

 
 

Reminds me of the tldr.sh site except for JS. I'm a big fan of both aspects!