Best “advanced beginner” resources for learning JS on an Android phone?


Best “advanced beginner” resources for learning JS on an Android phone?

Hello, I'm getting my rusty Javascript skills back in shape, and would like to be able to practice on my phone.

I've done plenty of "beginner" tutorials, and am (gradually) reading some more "learn JS properly" types of books.

What I would love is a collection of small programs (simple games, etc.) with which to practice…

… and also a recommendation for the best environment to code JS in on an Android phone.

Thank for your suggestions!

Submitted June 10, 2017 at 10:22PM by gntsketches
via reddit http://ift.tt/2sO9bqK

[HELP] Why can’t I check if a display mode is present in an event listener here?


[HELP] Why can’t I check if a display mode is present in an event listener here?

I have an alert box that is initially set to display: none; in the CSS. If there are alerts, the display mode is set to inline-block. That functionality is handled with this listener: bellLI.addEventListener('click', (e) => { // Check if notifications are present and display alert box if so

 if (bellLI.classList.contains('notifications-ready')) { bellLI.classList.remove('notifications-ready'); alertBox.style.display = 'inline-block'; indicator.style.display = 'none'; } else { bellLI.classList.add('notifications-ready'); alertBox.style.display = 'none'; } }); 

Now I want to be able to close the alert by clicking anywhere on the body, so I stored a reference to the body element in a constant called body and tried doing this:

body.addEventListener('click', () => { if (alertBox.style.display !== 'none') { alertBox.style.display = 'none'; } }); 

But it doesn't work. Help please? How do I make it so I can click outside of the alert box to make the box disappear?

EDIT: I also tried if (alertBox.style.display === 'inline-block') {}

Submitted June 10, 2017 at 10:27PM by mayaswelltrythis
via reddit http://ift.tt/2t6CioM