The tech English for FrontEnd 5
- Why is the non blocking nature of Javascript crucial?
Because it allows JavaScript applications remain responsive and efficient while it’s running on server side or client side. There are some key reasons for that:
– Handling the multiple tasks efficiently, since JavaScript is non-blocking I/O operation, we don’t have to wait the previous tasks finished before starting the next one without freezing the application.
– Improving the user’s experience on browser, if the JavaScript is not non-blocking language, when you do some slow task like requesting to server side, you will freeze your entire page, make it unresponsive.
– Enabling the scalability of web server, since it’s a single-threaded and non-blocking language, you don’t have to fork many threads under heavy traffic, it’s also easy for us to scale it in less complexity.
So, I would say the non-blocking is crucial for JavaScript. - What is the XSS attack in web development?
XSS is stand for Cross-Site Scripting, which is a security vulnerability where an attacker injects malicious JavaScript into a web page, which then executes in a user’s browser. This allows the attacker to steal data, manipulate web pages, or even gain control over user sessions. So here are some tactics for handling this attack, for examples:
– We can remove or escape the special characters from a user’s input.
– Using the innerText instead of the innerHTML
– Using the CSP to restrict the inline JavaScript code execution
– Validate or escape Data on the server side.
important terms:
- responsive: 可响应的
- I/O operation: I/O 操作
- non-blocking: 非阻塞
- scalability: 扩展性
- heavy traffic:高流量
- complexity:复杂度
- security vulnerability:安全漏洞
- malicious:恶性的
- tactics:策略
- restrict:限制
- escape Data:转义数据