elderinteralliance / githubworkshop Goto Github PK
View Code? Open in Web Editor NEWCode for the Elder INTERalliance GitHub workshop on 11/9/2019
Home Page: https://eldergithubworkshop.herokuapp.com
Code for the Elder INTERalliance GitHub workshop on 11/9/2019
Home Page: https://eldergithubworkshop.herokuapp.com
When a new level is loaded it displays multiple errors instead of the single error it should be displaying.
I have an object that looks like this:
var object = {"keyword": "next", "other word": "wrong", "test": "wrong"}
it was loaded from a json file accessed from the server using the fetch API. I then have an input box that when a user enters one of the three keys of the object should echo its value on enter. If no keys are found in the string the user has input it should print out an error message. If the value of the key is "next" it should run a function called loadlevel() to load the next level. That next level is then loaded in the same way as the aforementioned one. This appears to be where I am having issues. When it loads the new json file it seems that both the previous object and the new object are still running. This causes it to print out the error message if the new input doesn't match both the new keys. See example below:
//This is the first object loaded from the json file:
var object = {"keyword": "next", "other word": "wrong", "test": "wrong"}
When the user inputs the following strings it should have the corresponding outputs:
"this is the other word" => "wrong"
"hello, world" => "error"
"this is the keyword" => "next" loadlevel()
When the next level is loaded, say this for example:
var object = {"smith": "next", "hello": "wrong", "hi there": "wrong"}
It should then output this:
"this is the other word" => "error"
"hello, world" => "wrong"
"this is smith" => "next" loadlevel()
The first values seem to work fine:
"this is the other word" => "wrong"
"hello, world" => "error"
"this is the keyword" => "next" loadlevel()
When the next level is loaded, say this for example:
var object = {"smith": "next", "hello": "wrong", "hi there": "wrong"}
It then outputs this:
"this is the other word" => "error" "error"
"hello, world" => "wrong" "error"
"this is smith" => "next" "error" loadlevel()
Exactly as described in the title. The tab freezes when the third option is selected. Will test by adding a 4th option to see if it is just the third or the last in general and update the issue with those results.
I have done more testing and it appears to just be the last option, not necessarily the third.
The program is not searching the entire string input. Likely has to do with the string not being properly converted to an array. Possibly some issues with spaces?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.