All Questions
19 questions
26votes
2answers
133kviews
Extract numbers from a string-Javascript
Consider the following string in javascript: var string="border-radius:90px 20px 30px 40px"; I want to extract the 4 numbers from that string and store them in ...
17votes
4answers
10kviews
Cropping a message using array splits
I am trying to write a simple function to crop a given message to a specific length but at the same time not to cut the words in between and no trailing spaces in the end. Example: Input String: ...
14votes
1answer
10kviews
Implement numbering scheme like A,B,C... AA,AB,... AAA..., similar to converting a number to radix26
I want to implement numbering scheme like Microsoft Word uses for numbering. first one gets = A,next is B, next is C, .... then AA, then AB,....and so on. as shown below ...
8votes
2answers
13kviews
Calculate all possible combinations of an array of arrays or strings
I'm using code adapted from this Stack Overflow question to calculate all possible combinations from an array, which may contains strings. For example: ...
8votes
1answer
4kviews
JavaScript string to Unicode (Hex)
This set of questions are related to a project I've published for converting characters, or strings, to Hex based Unicode; eg... ...
6votes
2answers
373views
Random quote rotator
On my website, I created like this banner that rotates quotes from an array I made. ...
5votes
2answers
720views
Finding substrings within arrays
I need to find the substrings within my array. If I have an array: ["abc", "abcd", "abcde", "xyz"], my method should return the array members: ...
4votes
3answers
16kviews
Reverse string in JavaScript without using reverse()
I have to reverse a string in JavaScript and cannot use the built in reverse() function. It does not seem efficient to have to create two arrays but is there a ...
4votes
3answers
6kviews
Improving the code to turn a string into an array of numbers?
I have a string of numbers, like "31654918562314", and I want to convert it into an array of integers. The code I've written is: ...
4votes
2answers
888views
JavaScript number obfuscater
I got inspired to do this after seeing this repo containing a bunch of weird syntactical quirks in JS, namely this example called "It's a fail!". The example was essentially the following: You would ...
3votes
1answer
5kviews
Codewars "Consecutive strings" kata
The challenge description is as follows: You are given an array strarr of strings and an integer k. Your task is to return the ...
3votes
2answers
88views
Transform a string into an array based on grouping rules
I've got a simple spec for defining character sets, ranges, or wildcards. I'd like to take the string and appropriately create an array based on these rules. I have a solution but I'm sure there is a ...
2votes
1answer
63views
JS animated string builder
Today, I tried to write a simple function that would display the characters of my string one by one by iterating over a string containing the letters of the alphabet and showing the steps on the ...
2votes
1answer
75views
Receive an array input and output a string
I have some code which is working, but I would be interested if anyone could review it and tell me if there is a more efficient way of achieving my goal. I receive input from a data source as an ...
2votes
2answers
114views
Implementing a Sort for an Array
Yesterday, I gave an interview after a long time, and I was asked a question which I couldn't solve on the spot. I had to implement a sort function for a Array of strings in JavaScript, with the ...