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: | BrokenMind |
---|---|
Location: | Central Pennsylvania United States |
Users: | 60 |
Nodes: | 4 (0 / 4) |
Uptime: | 57:30:58 |
Calls: | 177 |
Files: | 2,017 |
Messages: | 20,571 |