GithubHelp home page GithubHelp logo

jenniferfubook / javascriptweb Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 43 KB

JavaScript Web is a resource for frontend job interview and daily development work.

License: MIT License

javascript interview interview-prep regular-expressions frontend-development web-development functional-programming pure-function high-order-function microservice

javascriptweb's Introduction

JavaScript Web

As a veteran software engineer, I have architected and developed a number of software management systems using Java/JavaScript. I have been the interviewer and interviewee for many frontend developer positions. I published ACE Your Java Interview a few years ago, which is still a best-seller today.

My fellow developers ask me when I am going to publish an interview reference book for JavaScript. I have been working on it for a while. The content keeps changing along with the evolving ECMAScript standards, as well as emerging frameworks and libraries. It becomes a never-ending project.

For years, I have been nourished by a lot of open source materials. I have read many articles, and some of them become my favorites. Why don’t I link them in a centralized location to make a JavaScript Web for easy access? It is no longer a conventional book. It is composed by many people’s work, and it is a resource for frontend job interview and daily development work.

This provides a number of advantages:

  • It allows constantly adding and updating content.
  • It speeds up the writing process.
  • It gets on-going feedback.

Happy reading and practicing!

Types and Type Coercion

JavaScript has 2 data types: primitives and objects. There are 7 primitive data types: string, number, bigint, boolean, null, undefined, and symbol.

Type coercion is the process of converting value from one type to another. An object is converted to a primitive, which is then converted to the final type. Type coercion will transform a value to string, boolean, or number. Values can be converted explicitly, or implicitly by operations between different types or by the surrounding context.

The strict equality (===) doesn’t trigger type coercion, while the loose equality operator (==) does type coercion if needed, and then compares.

Functional Programming

Functional programming is a programming paradigm. It builds software by composing pure functions, avoiding shared state, mutable data, and side effects. Functional programming is declarative rather than imperative, and application state flows through pure functions.

Higher-order functions are functions that take other functions as arguments or return functions as their results. Functions are objects in JavaScript. It is treated as first-class citizens.

Currying is about decomposing a function taking multiple arguments into numerous functions with single arguments. It is named after Haskell Curry.

Microservices are not specific to JavaScript. However, conceptually, functional programming is an analogy for microservices: single purpose, loose coupling, and high cohesion. It is fun to read about this hot topic.

Regular Expressions

Regular expressions are patterns used to match character combinations in strings. It is extremely effective for searching, manipulating, and validating strings.

A Practical Guide to Regular Expressions is comprehensive with handson examples.

Lookbehind and Lookahead are the latest additions to the Regular expression family.

Online Regular Expression Tester and Debugger is a convenient tool to test out specific regular expressions.

Linter

A linter is a static code analysis tool for identifying problematic patterns found in JavaScript code.

  • JSLint: It is the oldest linter. Douglas Crockford created it in 2002 to enforce the good parts of JavaScript. It is configured and ready to go, and it is not configurable or extensible.

  • JSHint: It is a more configurable version of JSLint. It supports many libraries out of the box, such jQuery, QUnit, NodeJS, Mocha, etc. It has basic ES6 support. However, it has no custom rule support.

  • ESLint: It is the most popular linter. It is easily extensible, and comes with a large number of custom rules. It has the best ES6 support.

  • TSLint: It is a linter to identify and report errors and enforce conventions for TypeScript. It has been deprecated. The recommended way is using ESLint’s TypeScript support, typescript-eslint.

  • Html-linter: It is a linter to identify and report errors and enforce conventions for HTML files.

  • Stylelint: It is a linter to identify and report errors and enforce conventions for styles.

Testing

Testing Types

  • Unit test: Specify and test one point of the contract of single method of a class. This should have a very narrow and well defined scope. Complex dependencies and interactions to the outside world are stubbed or mocked.

  • Integration test: Test the correct inter-operation of multiple subsystems. There is whole spectrum there, from testing integration between two classes, to testing integration with the production environment.

  • Acceptance test: Test that a feature or use case is correctly implemented. It is similar to an integration test, but with a focus on the use case to provide rather than on the components involved.

  • Functional test: Test features on the business requirements of the system.

  • Smoke test: Initial tests to decide whether the system is good enough for continuous testing.

  • Regression test: A test that was written when a bug was fixed. It ensures that this specific bug will not occur again.

  • System test: Test the software as a black box.

  • End-to-end test: Test a user behavior with the system in a complete application environment.

  • Performance test: Test to check the behaviors of the system when it is under significant load.

Testing Tools

  • Test launchers: Launch tests in a browser or Node.js with user config using the CLI or UI. This can also be achieved by opening the browser manually - Karma, Jasmine, Jest, TestCafe, Cypress

  • Testing structure providers: Help arranging test files - Mocha, Jasmine, Jest, Cucumber, TestCafe, Cypress

  • Assertion functions: Verify whether the results a test returns are as expected - Chai, Jasmine, Jest, Unexpected, TestCafe, Cypress

  • Generate and display test progress and results - Mocha, Jasmine, Jest, Karma, TestCafe, Cypress

  • Mocks, spies, and stubs - Isolate certain parts of tests and catch their side effects - Sinon, Jasmine, enzyme, Jest, testdouble

  • Generate and compare snapshots of component and data structures: Make sure changes from previous runs are intended - Jest, Ava

  • Generate code coverage reports: Verify how much of the code is covered by the tests - Istanbul, Jest, Blanket

  • Browser controllers: Simulate user actions for Functional Tests - Nightwatch, Nightmare, Phantom, Puppeteer, TestCafe, Cypress

  • Visual regression tools: Compare the site to its previous versions visually by using image comparison techniques - Applitools, Percy, Wraith, WebdriverCSS

Gists

Gists are a collection of code snippets for understanding the JavaScript concepts. It is also a resource to review before a frontend job interview.

curry, debounce, mergeDeep, throttle

javascriptweb's People

Contributors

jenniferfubook avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.