JSFiddle - React, Tailwind, and code Playground
HTML
<pre id="printTo"></pre>
JavaScript
function Logic(length)
{
this.input = [0];
this.length = length;
this.printTo = document.getElementById("printTo");
this.count = function count()
{
for (var i = 0; i <= this.length; i++) //loop through the input num times
{
this.printTo.innerHTML += this.input.join("")+"<br>"; //print to screen for each loop that occurs
for (var num in this.input) //cycle through each item and check it's value
{
if (this.input[num] == 0)
{
this.input.push(1); //append the appropriate value
}
else
{
this.input.push(0); //append the appropriate value
}
}
}
}
}
var deploy = new Logic(6);
deploy.count();