Skip to main content
3 of 3
deleted 2 characters in body; edited tags
Riker
  • 7.9k
  • 4
  • 39
  • 73

Javascript tips: 2 to the power of x multiplied by n

I'm new to ES6 and code-golfing. Here's the original function:

function puzzle(n, x) {
  return n * Math.pow(2, x);
}

And here's what I have so far:

let puzzle=(n,x)=>n*2<<(x-1)

But the solution requires lesser characters. I went through the 'Code Golfing with ES6' thread, but couldn't find a better way. Any help/links would be appreciated.