Created
February 10, 2017 21:04
-
-
Save TikiTDO/c5196b7c98895840107838c09a489a76 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = "0011010111" | |
var number = parseInt(data, 2) | |
var toSend = {} | |
if (number & 1 << 0) toSend.first = true | |
if (number & 1 << 1) toSend.second = true | |
if (number & 1 << 2) toSend.third = true | |
if (number & 1 << 3) toSend.fourth = true | |
if (number & 1 << 4) toSend.fifth = true | |
if (number & 1 << 5) toSend.sixth = true | |
if (number & 1 << 6) toSend.seventh = true | |
if (number & 1 << 7) toSend.eight = true | |
if (number & 1 << 8) toSend.ninth = true | |
if (number & 1 << 9) toSend.tenth = true | |
addToPost(toSend) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment