r/webdev • • Feb 20 '17

Learn JavaScript With Interactive Challenges X-Post /r/JavaScript

https://edabit.com/explore
205 Upvotes

36 comments sorted by

View all comments

17

u/memystic Feb 20 '17

I really hope some people find this to be a fun tool. I spent a little over five months building it by myself.

Before anyone asks, yes, the backend currently supports other languages! Specifically:

  • C

  • C#

  • C++

  • Elixir

  • F#

  • Haskell

  • Java

  • JavaScript

  • Objective-C

  • OCAML

  • Php

  • Python

  • Ruby

  • Rust

  • Swift

Once I’ve smoothed out the rough edges and squashed some bugs, I’ll begin working on rolling other languages out. Also, the challenges right now are rather easy BUT the system allows anyone to publish their own challenges. So if you want harder/more challenges, by all means please help out! :)

3

u/tallahasseenaut Feb 21 '17 edited Feb 21 '17

Cool! just created a challenge … EDIT: another and another. I'm really enjoying this :)

2

u/memystic Feb 21 '17

Woot! Finally I can play with my creation!

1

u/elingeniero Feb 21 '17
function flattenArray(arr) {
  if (!arr) return [];
  return arr
  	.reduce((acc, x) => {
      if (Array.isArray(x)) return acc.concat(flattenArray(x));
      if (typeof x === 'function') return acc.concat(x());
      return acc.concat(x);
    }, []);
}

2.

function isBalanced(string) {
  if (!string) return undefined;
  if (string.length % 2 !== 0) return false;
  const bracketPairs = {
    '(': ')',
    '[': ']',
    '{': '}',
  };
  for (let i = 0; i < string.length / 2; i ++) {
    if (bracketPairs[string[i]] !== string[string.length - i - 1]) return false;
  }
  return true;
}

3.

function isAnagram(s1, s2) {
  return s1.toLowerCase().split('').sort().join('') ===
    s2.toLowerCase().split('').sort().join('');
}

What do I win?

1

u/memystic Feb 20 '17 edited Feb 20 '17

Highjacking my comment to get feedback on a feature I'm working on right now. Here's a screenshot. Any user can create their own "group", which is essentially a chatroom with a private leaderboard. So you could, for example, invite your friends and compete with them to see who can get the most XP and help each other out in the chat area. The group can be either public or private: public groups can be joined by anyone and private groups need the owner to add them. Anyone will be able to create a group just like anyone can publish a challenge.

1

u/rs1712 Feb 20 '17

Can we get, code-golf added as well, more fun for experienced people :D

1

u/memystic Feb 21 '17

code-golf

Can you explain what code-golf is? I'm unfamiliar.

3

u/[deleted] Feb 21 '17

its basically trying to minimize the code size for a project. in effect: try and use as many arcane tricks as you can to save bytes (and effectively obfuscate your code).
example

1

u/rs1712 Feb 22 '17

askuriel did explain below, but its basically challenge to create the shortest code.

Also still getting the react/meteor errors http://imgur.com/a/Ww7iu