DEV Community

Bruce Axtens
Bruce Axtens

Posted on • Updated on

Learning Deno and liking what I see

Today I learned why there's some buzz going on about Deno. As someone who has always found Node difficult, Deno is a welcome relief.

Recently I started solving some computable problems on Quora using C#. One of them was What are words with a vowel to consonant ration of 2:3?. Below is Deno code re-implementing the C#. Please note that the word-list in the Deno solution is different from that of the C# version ( rather than

const rex = /[aeiou]{1}/ig;

const res = await fetch(

const body = new Uint8Array(await res.arrayBuffer());

const list = await new TextDecoder("utf-8").decode(body).split(/\r\n|\r|\n/g)
  .filter((line: string, index: number) => { // skip first two header lines
    return index > 1;
  .filter((word: string) => {
    const match = word.match(rex);
    if (null !== match) {
      const vowelcount = match.length;
      const consonantcount = word.length - vowelcount;
      if (vowelcount % 2 === 0) {
        if (vowelcount / 2 * 3 === consonantcount) {
          return true;
    return false;

list.forEach((line: string) => {
Enter fullscreen mode Exit fullscreen mode

There are probably better way to write that, but the await notation seemed fairly natural and made sense. Being able to use .filter was helpful too.

I think I'm going to enjoy learning Deno. Maybe you will too.

Discussion (0)