Skip to content
Navigation menu
Search
Powered by
Search
Algolia
Search
Log in
Create account
DEV Community
Close
One line of code (JS) Series' Articles
Back to Martin Krause's Series
1 line of code: How to count all occurrences in an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Oct 23 '21
1 line of code: How to count all occurrences in an Array
#
javascript
#
webdev
#
productivity
#
codequality
56
reactions
Comments
2
comments
1 min read
1 line of code: How to shallow clone an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Oct 24 '21
1 line of code: How to shallow clone an Array
#
javascript
#
webdev
#
productivity
#
codequality
30
reactions
Comments
7
comments
1 min read
1 line of code: How to check if an Array is empty
Martin Krause
Martin Krause
Martin Krause
Follow
Oct 25 '21
1 line of code: How to check if an Array is empty
#
javascript
#
webdev
#
productivity
#
codequality
41
reactions
Comments
18
comments
1 min read
1 line of code: How to remove all duplicates from an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Oct 26 '21
1 line of code: How to remove all duplicates from an Array
#
javascript
#
webdev
#
productivity
#
codequality
45
reactions
Comments
11
comments
1 min read
1 line of code: How to get lowest numeric element of an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Oct 27 '21
1 line of code: How to get lowest numeric element of an Array
#
javascript
#
webdev
#
productivity
#
codequality
19
reactions
Comments
Add Comment
1 min read
1 line of code: How to get highest numeric item of an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Oct 28 '21
1 line of code: How to get highest numeric item of an Array
#
javascript
#
webdev
#
productivity
#
codequality
30
reactions
Comments
9
comments
1 min read
1 line of code: How to get the closest numeric item of an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Oct 29 '21
1 line of code: How to get the closest numeric item of an Array
#
javascript
#
webdev
#
productivity
#
codequality
7
reactions
Comments
3
comments
1 min read
1 line of code: How to get the index of the lowest numeric item of an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Oct 30 '21
1 line of code: How to get the index of the lowest numeric item of an Array
#
javascript
#
webdev
#
performance
#
codequality
5
reactions
Comments
2
comments
1 min read
1 line of code: How to get the first index of the highest numeric item of an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Oct 31 '21
1 line of code: How to get the first index of the highest numeric item of an Array
#
javascript
#
webdev
#
performance
#
codequality
5
reactions
Comments
Add Comment
1 min read
1 line of code: How to split an Array in half
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 1 '21
1 line of code: How to split an Array in half
#
javascript
#
webdev
#
performance
#
codequality
23
reactions
Comments
17
comments
1 min read
1 line of code: How to get the longest string of an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 2 '21
1 line of code: How to get the longest string of an Array
#
javascript
#
webdev
#
performance
#
codequality
5
reactions
Comments
Add Comment
1 min read
1 line of code: How to get the shortest string of an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 3 '21
1 line of code: How to get the shortest string of an Array
#
javascript
#
webdev
#
performance
#
codequality
4
reactions
Comments
Add Comment
1 min read
1 line of code: How to the get length of the shortest string of an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 4 '21
1 line of code: How to the get length of the shortest string of an Array
#
javascript
#
webdev
#
performance
#
codequality
6
reactions
Comments
2
comments
1 min read
1 line of code: How to get the length of the longest string of an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 8 '21
1 line of code: How to get the length of the longest string of an Array
#
javascript
#
webdev
#
productivity
#
codequality
6
reactions
Comments
Add Comment
1 min read
1 line of code: How to get every odd item of an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 9 '21
1 line of code: How to get every odd item of an Array
#
javascript
#
webdev
#
performance
#
codequality
25
reactions
Comments
13
comments
1 min read
1 line of code: How to get every even item of an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 10 '21
1 line of code: How to get every even item of an Array
#
javascript
#
webdev
#
performance
#
codequality
19
reactions
Comments
16
comments
1 min read
1 line of code: How to merge two Arrays and clean all duplicate entries
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 11 '21
1 line of code: How to merge two Arrays and clean all duplicate entries
#
javascript
#
webdev
#
performance
#
codequality
33
reactions
Comments
3
comments
1 min read
1 line of code: How to merge two Arrays and preserve all entries
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 15 '21
1 line of code: How to merge two Arrays and preserve all entries
#
javascript
#
webdev
#
productivity
#
codequality
3
reactions
Comments
Add Comment
1 min read
1 line of code: How to clean an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 16 '21
1 line of code: How to clean an Array
#
javascript
#
webdev
#
productivity
#
codequality
48
reactions
Comments
13
comments
1 min read
1 line of code: How to clean an Array of "falsy" items
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 17 '21
1 line of code: How to clean an Array of "falsy" items
#
javascript
#
webdev
#
productivity
#
codequality
5
reactions
Comments
2
comments
1 min read
1 line of code: How to get the sum of an array of numbers
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 18 '21
1 line of code: How to get the sum of an array of numbers
#
javascript
#
webdev
#
performance
#
codequality
3
reactions
Comments
2
comments
1 min read
1 line of code: How to get the average of an array
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 22 '21
1 line of code: How to get the average of an array
#
javascript
#
webdev
#
performance
#
codequality
10
reactions
Comments
9
comments
1 min read
1 line of code: How to get every n-th item of an Array
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 23 '21
1 line of code: How to get every n-th item of an Array
#
javascript
#
webdev
#
productivity
#
codequality
4
reactions
Comments
2
comments
1 min read
1 line of code: How to sort an array by ascending order
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 24 '21
1 line of code: How to sort an array by ascending order
#
javascript
#
webdev
#
performance
#
codequality
3
reactions
Comments
Add Comment
1 min read
1 line of code: How to sort an array by descending order
Martin Krause
Martin Krause
Martin Krause
Follow
Nov 30 '21
1 line of code: How to sort an array by descending order
#
javascript
#
webdev
#
performance
#
codequality
13
reactions
Comments
2
comments
1 min read
1 line of code: How to shuffle an array
Martin Krause
Martin Krause
Martin Krause
Follow
Dec 1 '21
1 line of code: How to shuffle an array
#
javascript
#
webdev
#
programming
#
codequality
3
reactions
Comments
Add Comment
1 min read
1 line of code: How to create a range array
Martin Krause
Martin Krause
Martin Krause
Follow
Dec 2 '21
1 line of code: How to create a range array
#
javascript
#
webdev
#
performance
#
codequality
5
reactions
Comments
10
comments
1 min read
1 line of code: How to count the words in a string
Martin Krause
Martin Krause
Martin Krause
Follow
Dec 6 '21
1 line of code: How to count the words in a string
#
javascript
#
webdev
#
productivity
#
codequality
5
reactions
Comments
5
comments
1 min read
1 line of code: How to capitalise a string
Martin Krause
Martin Krause
Martin Krause
Follow
Dec 7 '21
1 line of code: How to capitalise a string
#
javascript
#
webdev
#
performance
#
codequality
6
reactions
Comments
2
comments
1 min read
1 line of code: How to camelCase a string
Martin Krause
Martin Krause
Martin Krause
Follow
Dec 8 '21
1 line of code: How to camelCase a string
#
javascript
#
webdev
#
productivity
#
codequality
24
reactions
Comments
6
comments
1 min read
1 line of code: How to PascalCase a string
Martin Krause
Martin Krause
Martin Krause
Follow
Dec 13 '21
1 line of code: How to PascalCase a string
#
javascript
#
webdev
#
productivity
#
codequality
5
reactions
Comments
Add Comment
1 min read
1 line of code: How to create an URL Slug from a string
Martin Krause
Martin Krause
Martin Krause
Follow
Dec 14 '21
1 line of code: How to create an URL Slug from a string
#
javascript
#
webdev
#
productivity
#
codequality
7
reactions
Comments
4
comments
1 min read
1 line of code: How to convert html special chars
Martin Krause
Martin Krause
Martin Krause
Follow
Dec 16 '21
1 line of code: How to convert html special chars
#
javascript
#
webdev
#
productivity
#
codequality
5
reactions
Comments
Add Comment
1 min read
1 line of code: How to lower case a string
Martin Krause
Martin Krause
Martin Krause
Follow
Dec 22 '21
1 line of code: How to lower case a string
#
javascript
#
webdev
#
productivity
#
codequality
6
reactions
Comments
1
comment
1 min read
1 line of code: How to convert tabs to spaces
Martin Krause
Martin Krause
Martin Krause
Follow
Jan 5 '22
1 line of code: How to convert tabs to spaces
#
javascript
#
webdev
#
productivity
#
codequality
19
reactions
Comments
9
comments
1 min read
1 line of code: How to convert spaces to tabs
Martin Krause
Martin Krause
Martin Krause
Follow
Jan 11 '22
1 line of code: How to convert spaces to tabs
#
javascript
#
webdev
#
productivity
#
codequality
17
reactions
Comments
3
comments
1 min read
1 line of code: How to convert \newlines to <breaks />
Martin Krause
Martin Krause
Martin Krause
Follow
Jan 13 '22
1 line of code: How to convert \newlines to <breaks />
#
javascript
#
webdev
#
product
#
codequality
7
reactions
Comments
5
comments
1 min read
1 line of code: How to replace multiple spaces with one space
Martin Krause
Martin Krause
Martin Krause
Follow
Jan 19 '22
1 line of code: How to replace multiple spaces with one space
#
javascript
#
webdev
#
productivity
#
codequality
18
reactions
Comments
1
comment
1 min read
1 line of code: How to reverse all words of a string
Martin Krause
Martin Krause
Martin Krause
Follow
Jan 26 '22
1 line of code: How to reverse all words of a string
#
javascript
#
webdev
#
productivity
#
codequality
28
reactions
Comments
6
comments
1 min read
1 line of code: How to reverse a string
Martin Krause
Martin Krause
Martin Krause
Follow
Jan 28 '22
1 line of code: How to reverse a string
#
javascript
#
webdev
#
productivity
#
codequality
31
reactions
Comments
10
comments
1 min read
1 line of code: How to truncate a string at word boundaries
Martin Krause
Martin Krause
Martin Krause
Follow
Feb 16 '22
1 line of code: How to truncate a string at word boundaries
#
javascript
#
webdev
#
productivity
#
codequality
10
reactions
Comments
3
comments
1 min read
We're a place where coders share, stay up-to-date and grow their careers.
Log in
Create account