+ 8

¿¿¿Why does the Code of The Day output an error¿¿¿

a line 1 error:

30th Jun 2017, 5:43 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
14 Respuestas
30th Jun 2017, 6:06 PM
Maz
Maz - avatar
+ 9
@Nomeh don't forget the credits to the original author (TheOtherOne), no need to give me credits.. ;) @Dustin this is because you opened the keyboard, just close the keyboard before to run it, canvas is not resizing automatically. :/ EDIT - Noticed some downvotes, it is obviously i'm not taking credits for the other efforts and in an Open Source code i should be able to modify a code to improve it, so... if someone is offended in some way, idk... peace. Credits to @TheOtherOne only, i think his work is awesome and should be watched from everybody (also people with an old browser like mine) In addition, i keep the code private and i added his name everywhere, so... cheers. :3
30th Jun 2017, 6:21 PM
Maz
Maz - avatar
+ 8
You have to replace just the JS, i did not insert other parts of code because this is not my work, but just the JS fixed version of TheOtherOne's code :3
30th Jun 2017, 6:15 PM
Maz
Maz - avatar
+ 7
Answered by Maz in the comments of the code: Awesome, congratulation for the COTD, your works are impressive. My browser does not support ES6 specifications and for those who have the same problem (Uncaught SyntaxError: Unexpected Token line: 1) it is necessary delete the initializations inside the first function, for the touchmove event i recommend to add a preventDefault() inside the function (in my browser it works in this only way) Hope to see more from you, well done! :)
30th Jun 2017, 6:00 PM
jay
jay - avatar
+ 4
does it? worked for me?
30th Jun 2017, 5:50 PM
jay
jay - avatar
+ 3
canvas { width:100vw; height:100vh; } Fixes the keyboard cutoff problem.
1st Jul 2017, 1:46 AM
Kirk Schafer
Kirk Schafer - avatar
+ 2
@Maz, Well the output is /* Uncaught TypeError: Cannot set property 'width' of null Line: 88. */
30th Jun 2017, 6:14 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 2
@Maz I know that's why it's private
30th Jun 2017, 6:22 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 1
The Console says /* Uncaught SyntaxError: Unexpected Token = Line: 1 */
30th Jun 2017, 5:59 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
30th Jun 2017, 6:20 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 1
@maz tried it and it works, but cuts off the whole bottom half, literally 50%of the page from the middle downward doesn't even show when moving the snake. the original code works just fine on my phone but adding your code does not work properly, no errors thrown just does not work properly. So for newer browsers your code does not work as expected
30th Jun 2017, 6:20 PM
Dustin Hammack
Dustin Hammack - avatar
+ 1
@maz, working now. not sure why but had to close and reopen SL... great job to you and @TheOtherOne
30th Jun 2017, 6:25 PM
Dustin Hammack
Dustin Hammack - avatar
0
@maz, your code gives me an error, line 88 "cannot set width of null ", the cotd does not...
30th Jun 2017, 6:15 PM
Dustin Hammack
Dustin Hammack - avatar
0
makes sense, didnt think the rest of code wasn't even there. I'll try it
30th Jun 2017, 6:16 PM
Dustin Hammack
Dustin Hammack - avatar