Skip to content

Slight tweak#1

Open
kingkool68 wants to merge 1 commit into
jessabean:masterfrom
kingkool68:patch-1
Open

Slight tweak#1
kingkool68 wants to merge 1 commit into
jessabean:masterfrom
kingkool68:patch-1

Conversation

@kingkool68
Copy link
Copy Markdown

You don'y need the getQuote() function since it can be reduced to one line and you only use it once. Good thinking on cahcing the jQuery selector by storing the next button as it's own variable but if you don't use that cached selector again then it doesn't really matter.

Another fun technique is to bind an event to an element and then you want to trigger that event so you could write $('.next').on('click', randomize).trigger('click') which tells jQuery to basically simulate a click on the next button triggering your randomize() function.

You don'y need the getQuote() function since it can be reduced to one line and you only use it once. Good thinking on cahcing the jQuery selector by storing the next button as it's own variable but if you don't use that cached selector again then it doesn't really matter. 

Another fun technique is to bind an event to an element and then you want to trigger that event so you could write `$('.next').on('click', randomize).trigger('click')` which tells jQuery to basically simulate a click on the next button triggering your `randomize()` function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant