JSFiddle - React, Tailwind, and code Playground

by Jessie Lau

HTML

1-> 2  1*2
2->  4   2*2
3 -> 8   2*2*2
4 -> 16  2*2*2*2
5 -> 32

JavaScript

function powers(list) {
  var powerSet = 1;  
  for(var i = 1; i <= list.length; i++){
  	powerSet *= 2;
  }  
    return powerSet;
}

console.log(powers([1,2,3,4]));