The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

3

JavaScript You don't have to list down all characters. All printable characters in the ASCII range are found in 33-126. What you could do is generate a random number within this range, and convert them into characters using String.fromCharCode(). Also, it's always a good practice to separate business logic from view logic. You will want to be able to ...


2

Don't repeat the queries. Store any queries that are called more than once in a variable, and utilize jQuery's chaining: const navbarNav = $( '#navbarNav' ); const htmlBody = $( 'html, body' ); navbarNav.on( 'show.bs.collapse', function() { htmlBody.addClass( 'noscroll' ); }).on( 'hide.bs.collapse', function() { htmlBody.removeClass( 'noscroll' ); }...


Top 50 recent answers are included