I have some functions that change a user input as a binary number in the form of a string. This is part of a basic 'assembler' program on which I am working. Here is my code:
Function GenerNinBurnerNumber (InputWall) // only works for hash! {Var number; If (hash (input value) in it! = -1) {number = getNumberFromString (inputValue); } Return Decimal Tokyo (number); } Function hash (number) // functioning! {Var n = number.indexOf ('#'); Return n; } Function getNumberFromString (mixed input) // work! {Return (mixed input. Location ('#', '')); } Function Decimal Tutorial (Decimal) // Working! {Decimal = parsih (decimal); Return decimal Two string (2); } For example, if a user enters the value of '5', then the function returns NaN - although if they specify that # 5 works - 101 returns. I'm new to programming and javascript, if someone could point me in the right direction which would be great. Thanks!
if any # function Generate BinaryNumber (inputValue) // only works for hash! {Var number; // if the number is not set (hash (input value) in it! = -1) {// the number is set here, but only if if statement is true number = getNumberFromString (inputValue); } // If, then hash was false, the number is undefined decimal decimal number (number); } You only want to say var number = inputValue when you declare it As a side note, Your paraset does not look like a radius argument (something like parseInt (decimal, 10) ) otherwise it will input as hex digits such as "010" and it will Will parse incorrectly.
No comments:
Post a Comment