I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser); where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:
I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser);
where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:
What is the correct usage of console.getkeys? I inferred:
console methods
getkeys:
number console.getkeys(string keys [,maxnum]) 3.10 get one key from m of
a list of valid command keys, or a number between 1 and maxnum
Re: console.getkeys
By: Mortifis to All on Wed Jul 24 2019 16:39:55
I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser); where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:
That looks like it should work. What's the full text of the error?
Re: console.getkeys
By: Mortifis to All on Wed Jul 24 2019 16:39:55
I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser); where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:
That looks like it should work. What's the full text of the error?
!JavaScript C:\sbbs\exec\dup_user_check.js line 277: TypeError: lookup.toUpperC
ase is not a function
I suspect that the toUpperCase() is not be supported by the console.getkeys() function :-/
Re: console.getkeys
By: Mortifis to All on Wed Jul 24 2019 16:39:55
I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser); where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:
Re: console.getkeys
By: Mortifis to All on Wed Jul 24 2019 16:39:55
I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser); where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:
perhaps I should run a condition check similar to if(lookup == [whatever || ... keys are in getkeys)) before I lookup.toUpperCase ... though before it was lookup = readln() and there was no error
Re: Re: console.getkeys
By: Mortifis to echicken on Wed Jul 24 2019 06:52 pm
Re: console.getkeys
By: Mortifis to All on Wed Jul 24 2019 16:39:55
I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser); where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:
perhaps I should run a condition check similar to if(lookup == [whatever || ... keys are in getkeys)) before I lookup.toUpperCase ... though before it was lookup = readln() and there was no error
readln() returns either a string or undefined. undefined.toUpperCase() would also throw a JS exception.
You might want to use typeof in this case to be sure your variable is a string before you start treating it like a string.
digital man
Sysop: | Chris Crash |
---|---|
Location: | Huntington Beach, CA. |
Users: | 585 |
Nodes: | 8 (0 / 8) |
Uptime: | 27:02:29 |
Calls: | 10,757 |
Files: | 5 |
Messages: | 452,126 |