We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a440def commit e082fc1Copy full SHA for e082fc1
1 file changed
js/script.js
@@ -19,11 +19,14 @@ const commands = [
19
]
20
21
function run(commandInput) {
22
- for (const command of commands) {
23
- if(command.name == commandInput.value){
24
- return command.run()
25
- }
+ let input = commandInput.value
+ let command = commands.filter(function (command) {
+ return command.name === input;
+ })
26
+ if(command === null || command.length === 0) {
27
+ return console.log(`Command ${input} not found`)
28
}
29
+ command[0].run()
30
31
32
function detectEnter(event,input) {
0 commit comments