Web development is so interesting! But JavaScript is... daunting.
Everything else in Web development is a piece of cake for you, but when you delve deeper into JavaScript, you can’t help but have a tragic feeling of "everyone is awake but you are drunk alone" - just like other Everyone knows some big basic knowledge content that you don’t know, and these content can help you understand all knowledge.
The truth is, it is true, you are missing some important pieces to solve the problem.
And, front-end development has actually gone crazy.
It’s not just you.
Pull up a chair and sit down. It’s time to write a JavaScript application.
The first step is to prepare the local development environment and run it. So Gulp or Grunt, wait, no... NPM scripts too!
Use WebPACK or Browserify? Require.js? Upgrading to ES6? Or adding Babel to your preprocessing too much?
BDD or regular unit testing? What assertion framework should be used? Of course running the tests from the command line would be nice, so maybe PhantomJS would work too?
Angular or React? Ember? Backbone?
You read some React documentation, "Redux is a predictable state container for JavaScript apps." Awesome! You definitely need one of those.
Why is it so crazy to build JavaScript applications? ! ?
Let me help you understand why I am saying all of this is so crazy. Let's start with an example and then move to pretty pictures.
This is React's "Hello, world!" application.
// main.js var React = require('react'); var ReactDOM = require('react-dom'); ReactDOM.render( <h1 id="Hello-nbsp-world">Hello, world!</h1>, document.getElementById('example') );
Not completely finished.
$ npm install --save react react-dom babelify babel-preset-react $ browserify -t [ babelify --presets [ react ] ] main.js -o bundle.js
There are actually a few steps missing here, such as installing browserify and what you actually need to do to get it to run on the web once you've done that, because that doesn't actually produce a content of the web page. ¯\ _(ツ)_ /¯
After completing this, you will finally need a file called bundle.js, which contains the new React Hello World application — —The program has 19,374 lines of code. And you only need to install browserify, babelify and react-dom, and consider thousands of unknown lines of code.
So basically this is...
Marc is almost ready to implement his "Hello World" React app pic.twitter.com/ptdg4yteF1
—— Thomas Fuchs (@thomasfuchs) March 12, 2016
Let’s write a Hello World app using plain JavaScript code.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> <title>Hello World</title> </head> <body> <p id="container"></p> <script> document.body.onload = function(){ var container = document.getElementById("container"); container.innerHTML = '<h1 id="Hello-nbsp-world">"Hello, world!"</h1>'; } </script> </body> </html>
That’s it. 18 lines of code. You can copy/paste into the index.html file, double-click and load it into your browser. Finish.
If at this point you’re thinking, “Wait a minute, React can do more than this little thing you just wrote, and you can’t write a JavaScript app that way!” You are (big Most of the time) true, but you still have to take a small step to understand why everything is crazy.
The following is the picture I promised.
The vast majority of JavaScript web applications you will work on will fall somewhere in the middle of the bell curve. And in the middle, if you start with a full React stack, you're massively over-engineering your application from the get-go.
That's why everything goes crazy. Most of these tools you think are necessary to solve problems, but you have never encountered such a problem, and you will never encounter such a problem in the future.
Same picture:
Because by default, everyone over-designs their apps, but realizing this, Javascript development The state has become too verbose.
How should you start a JavaScript application? Should I use some tool like React or Angular? Should I use a package manager? If you don't, what should you do? Is testing necessary? Should the markup be generated in Javascript? All of these are questions you should ask yourself before launching a massive technology stack that comes by default.
When you launch a JavaScript application, the key is to pick a point on the bell curve that is just ahead of the level of complexity you think the app will eventually reach.
I'm not going to lie, it takes experience to verify this. But there's a pretty big sweet spot here that lets you launch most JavaScript apps: jQuery plus client-side templates, and super-easy build tools for concatenating and minifying product files (assuming your backend architecture doesn't already have that) if done).
If you know how to build a Javascript app properly, then you will start to understand how, when and why to use a framework or npm/requir/webPack or ES6, when to write tests, and when you should bother making your tests local Running vs. running in the browser, etc., all these questions come up.
Interested in filling those gaps with your JavaScript development knowledge? Want to avoid feeling overwhelmed and massively over-engineering your JavaScript applications in the process? That’s what I’ll be focusing on later, so stay tuned!
The above is the detailed content of Why JavaScript Development Is Such Insanely Detailed Code. For more information, please follow other related articles on the PHP Chinese website!

JavaScript runs in browsers and Node.js environments and relies on the JavaScript engine to parse and execute code. 1) Generate abstract syntax tree (AST) in the parsing stage; 2) convert AST into bytecode or machine code in the compilation stage; 3) execute the compiled code in the execution stage.

The future trends of Python and JavaScript include: 1. Python will consolidate its position in the fields of scientific computing and AI, 2. JavaScript will promote the development of web technology, 3. Cross-platform development will become a hot topic, and 4. Performance optimization will be the focus. Both will continue to expand application scenarios in their respective fields and make more breakthroughs in performance.

Both Python and JavaScript's choices in development environments are important. 1) Python's development environment includes PyCharm, JupyterNotebook and Anaconda, which are suitable for data science and rapid prototyping. 2) The development environment of JavaScript includes Node.js, VSCode and Webpack, which are suitable for front-end and back-end development. Choosing the right tools according to project needs can improve development efficiency and project success rate.

Yes, the engine core of JavaScript is written in C. 1) The C language provides efficient performance and underlying control, which is suitable for the development of JavaScript engine. 2) Taking the V8 engine as an example, its core is written in C, combining the efficiency and object-oriented characteristics of C. 3) The working principle of the JavaScript engine includes parsing, compiling and execution, and the C language plays a key role in these processes.

JavaScript is at the heart of modern websites because it enhances the interactivity and dynamicity of web pages. 1) It allows to change content without refreshing the page, 2) manipulate web pages through DOMAPI, 3) support complex interactive effects such as animation and drag-and-drop, 4) optimize performance and best practices to improve user experience.

C and JavaScript achieve interoperability through WebAssembly. 1) C code is compiled into WebAssembly module and introduced into JavaScript environment to enhance computing power. 2) In game development, C handles physics engines and graphics rendering, and JavaScript is responsible for game logic and user interface.

JavaScript is widely used in websites, mobile applications, desktop applications and server-side programming. 1) In website development, JavaScript operates DOM together with HTML and CSS to achieve dynamic effects and supports frameworks such as jQuery and React. 2) Through ReactNative and Ionic, JavaScript is used to develop cross-platform mobile applications. 3) The Electron framework enables JavaScript to build desktop applications. 4) Node.js allows JavaScript to run on the server side and supports high concurrent requests.

Python is more suitable for data science and automation, while JavaScript is more suitable for front-end and full-stack development. 1. Python performs well in data science and machine learning, using libraries such as NumPy and Pandas for data processing and modeling. 2. Python is concise and efficient in automation and scripting. 3. JavaScript is indispensable in front-end development and is used to build dynamic web pages and single-page applications. 4. JavaScript plays a role in back-end development through Node.js and supports full-stack development.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Mac version
God-level code editing software (SublimeText3)

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6
Visual web development tools
