In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
In this issue, the editor will bring you what the solutions to common JavaScript problems are. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.
Use JavaScript to make the window full screen
We can use full-screen API to make the window full-screen.
For example, we can write like this:
Document.documentElement.requestFullscreen ()
We just call the requestFullScreen method to change the window to full screen mode.
We can then call document.exitFullScreen to exit full-screen mode.
The fastest way to convert JavaScript NodeList to an array
We can use the extension operator (.) Or the Array.from method converts the JavaScript NodeList to an array.
For example, we can write like this:
Const els = Array.from (document.querySelectorAll ('p'))
We can use the propagation operator in the following ways:
Const els = [. Document.querySelectorAll ('p')]
Capitalize the first letter of each word
We can use some array methods to capitalize the first letter of each word.
For example, we can write like this:
Str = str.toLowerCase () .split ('') .map ((s) = > `${s.charAt (0). ToUpperCase ()} ${s.substring (1)}`) .join ('')
We first convert the string to lowercase, and then split the words using split.
Then we call map to match each word with the first letter uppercase and the rest lowercase.
Finally, we call join to put the words back together.
Verification of JavaScript file upload size
We can verify the size of the file without using any libraries.
For example, we can write like this:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.