preface

As a front-end developer, if you tell me that you haven’t read any front-end books, it’s safe to assume that you’re not a qualified front-end developer. Why should I measure a good front end by “reading a book”? Because the front end as a special very change and pioneering work, there is no strong self-learning and thinking ability, it is difficult to survive in this fierce and complicated environment without being eliminated, and “reading” is the most basic way to improve themselves and supplement knowledge.

There is a house of gold in books. Whether you want to dabble in the front end or do systematic learning, I recommend reading books on the front end. So for want of entry or solid front-end foundation of children’s shoes we should choose which books suitable for us? Here are five books that brought me to the front end and helped me a lot.

book

1. Best practices for Web front-end development

This book is a classic work in the field of front-end development, is a solid front-end basic skills, standardize our front-end code of practical books. This book focuses on best practices for HTML, CSS, Javascript, and mobile development, and can be a great help to developers without a good guide. Read this book to learn how to write highly readable, maintainable, and high-performance HTML, CSS, and Javascript. Such as:

<! If the class name is only used as the "hook" for Javascript calls, you can add the prefix "js" to the name.
<ul id="js_mylist">
    <li class="menu js-active">Best practices for Web front-end development</li>
    <li class="menu">Write maintainable Javascript</li>
    <li class="menu">Sharp jQuery</li>
    <li class="menu">The illustration of HTTP</li>
    <li class="menu">Javascript design patterns and development practices</li>
</ul>Copy the code
<! -- In order to disable the script when the page automatically jump, Baidu home added the following code -->
<noscript>
    <meta http-equiv=refresh content="0; url=http://www.baidu.com/baidu.html?from=noscript">
</noscript>Copy the code

Write maintainable Javascript

This is a highly recommended book to help you improve your Javascript programming style and coding practices. So why do we pay so much attention to THE JS coding specification? To quote Gartner, programs are written for people to read, and only occasionally for computers to execute. Maintaining code often takes up a large part of our daily development, so why don’t we pay attention to it when we write code? Here are two examples from the book:

Binary operators must be preceded by a space to keep the expression clean
// For better writing, use Spaces
for (i = 0; i < count; i++) {
    process(i);
}

// Bad writing, missing Spaces
for (i=0; i<count; i++) {
    process(i);
}Copy the code
// The first word name of a function should be a verb (not a noun) to avoid confusion with variables.
// The first word is a verb
function doSomething() {
    / / code
}

// The first word is a noun
function car() {
    / / code
}Copy the code

3. Sharp jQuery

This book is a must-read for learning jQuery. It is also a classic book on jQuery. Before you get to grips with this book, it’s important to understand native Javascript in order to understand the “write less, do more” philosophy of jQuery. This book introduces jQuery’s code styles, selectors, events, animations, etc., with rich examples for readers to quickly understand and use. Such as:

var $ul = $('ul').prev(); // Get the sibling immediately before the 
      
    element
var $p = $('p').siblings(); // Gets the sibling of the

element

Copy the code
$('input').trigger('focus'); // Trigger the input box focus event and get the focus
$('input').triggerHandler('focus'); // The input box focus event is triggered but the focus is not capturedCopy the code

4. Diagram to HTTP

As front-end developers working with browsers, we should learn about the process and implementation of a page from request to rendering, and this book is a great way to quickly understand the principles behind HTTP requests. This book explains HTTP protocol, working mechanism, message and status code in the form of cartoon pictures. Example:

// Request header field
Host: www.hackr.jp  // Host tells the server the Internet Host name and port number of the requested resource
Range: bytes=5001- 10000. // Tell the server the specified range of resourcesCopy the code
// Response header field
Age: 600 // Tell the client how long ago the source server created the response
Retry-After: 120 // Tell the client how long it should take to send the request againCopy the code

5. Javascript design pattern and development practice

The reason why I put this book last is because reading this book requires a certain Javascript foundation and skills, when we master the SYNTAX and coding standards of JS to read this book, you will get another harvest. So why do we study design patterns? What problems can we solve using design patterns?

I think the answer is the same as why novelists rarely design stories from the ground up, or why football coaches rarely invent tactics from the ground up. Here are two patterns in the book:

// Singleton pattern: Ensure that a class has only one instance and provide a global access point
var getSingle = function(fn) {
    var result;
    return function() {
        return result || (result = fn.apply(this.arguments)); }};Copy the code
// Strategy pattern: Define a series of algorithms, encapsulate them one by one, and make them interchangeable
var strategies = {
    "S": function(salary) {
        return salary * 4;
    },
    "A": function(salary) {
        return salary * 3; }};var calculateBonus = function(level, salary) {
    return strategies[level](salary);
};Copy the code

conclusion

Why do people who have worked for only a few years quickly hit their own technical bottlenecks? Why do people who have been working for more than 5 years still write code that is hard to maintain? I think the answer can be found in the above five books.

Of course, in addition to the five front-end introductory books recommended in the text, there are many excellent books not recommended here, please forgive me.

Is the so-called paper zhongjue shallow, and must know this to practice. In addition to absorb the knowledge we need from the book, we also need to put the theory into practice, hands-on keyboard, so as to deepen and consolidate the knowledge points in the book, to emerge and ascend immortal.