diff --git a/script.js b/script.js index 6582e0d..0039e55 100644 --- a/script.js +++ b/script.js @@ -1,11 +1,71 @@ console.log("hello script js"); +let output = ""; + +let character = ""; + +const init = function(){ + document.getElementById('input').value = ""; +} + +document.getElementById('output').textContent = "Type in the character or emoji that you would like to use."; + + var inputHappened = function(currentInput){ + debugger; console.log( currentInput ); - display( "WOW SOMETHING HAPPENED" ); + const inputSplit = currentInput.split(" ") + var res = inputSplit.every(function(element) {return typeof parseInt(element) === 'number';}); + console.log(res); + + if(inputSplit.length === 1 && character === ""){ + useCharacter(currentInput); + init() + document.getElementById('output').textContent = ""; + } + else if(inputSplit[0] === "clear" && isNaN(parseInt(inputSplit[1])) ){ + clear(); + } + else if(inputSplit[0] === "clear" && !isNaN(parseInt(inputSplit[1]))){ + clearRow(parseInt(inputSplit[1])); + } + else if (!isNaN(parseInt(inputSplit[0])) && isNaN(parseInt(inputSplit[1])) ){ + display( parseInt(currentInput) ); + } + else if (inputSplit.length > 1 && res) { + for(let a = 0; a