Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Data Structures and Algorithms with JavaScript

You're reading from   Hands-On Data Structures and Algorithms with JavaScript Write efficient code that is highly performant, scalable, and easily testable using JavaScript

Arrow left icon
Product type Paperback
Published in Jan 2018
Publisher Packt
ISBN-13 9781788398558
Length 332 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Kashyap Mukkamala Kashyap Mukkamala
Author Profile Icon Kashyap Mukkamala
Kashyap Mukkamala
Arrow right icon
View More author details
Toc

Best practices


Best practices is a relative term for obvious reasons. What is considered best is rather dependent on the team in which you work and what version of JavaScript you work with. In this section, we will try to cast a wide net over some of these best practices, and get an understanding of what some of the practices look like so that we can adapt and use them as well.

Best practices for HTML

Let's approach this section top-down and address the best practices for each of the sections within an HTML file.

Declaring the correct DOCTYPE

Have you ever wondered why we have <!DOCTYPE html> at the top of our page? We can clearly leave it out, and still the page seems to work. Then, why exactly do we need this? The answer is avoiding backward compatibility—if we do not specify the DOCTYPE, the browser that is interpreting and rendering our HTML goes into quirks mode, which is a technique to support really old websites that were built with outdated versions and markups of HTML, CSS, and...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime