Web Tools #541 - JavaScript Utilities, Build Tools, Uncats
source link: https://mailchi.mp/webtoolsweekly/web-tools-541
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
JavaScript Utilities, Build Tools, Uncats
|
Issue #541 • November 30, 2023
Advertisement
|
Build And Style Your Site Exactly How You Want Drag in unstyled HTML elements, control CSS properties, and cascade changes across your site. Then, take full control of CSS properties and a class system that cascades changes across your site — plus use variables to sync with external design systems. |
|
Here are a couple of quick tips for using JavaScript's String.split() method, which I'm sure most of you have used extensively over the years.
That's how most String.split() operations take place, a simple way to split where you're removing the character I'm splitting with and getting everything else in an array.
I've passed in "2" as the second argument, which splits the first two items but ignores everything else. If I pass in "0", I'll get an empty array and if I pass in more than the number of items available to split, it will return all the available ones.
Notice here my string is a bunch of words separated by hyphens. I'm using a regular expression with capturing parentheses, thus the separator character is preserved as part of the array. In this case, it adds three hyphens in their own array slots. |
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK