News for hackers. Stuff that matters.
Re:JavaScript Pattern Matching Proposal by jbob2000 on Wednesday April 25, 2018 @11:13AM (#16922228)
Instead of using if or switch statements to compute a value, you can use a prettier interface.

So this:

  function getStatus(status) {
    if (status === 200){
      return "Success";
    } else if (status === 401){
      return "Fail!";
    }
  }

  var myString = getStatus(response.status);
Now becomes this:

  var myString = match (status) {
    {200} => "Success",
    {401} => "Fail!"
  }
Re:JavaScript Pattern Matching Proposal by megous on Wednesday April 25, 2018 @11:47AM (#16922652)
More like:

  var myString = match (status) {
    200 => "Success",
    401 => "Fail!"
  }