Skip to main content

All Questions

Filter by
Sorted by
Tagged with
3 votes
1 answer
111 views

garbage string remover with array or object input

This is the second time I am writing any practical JavaScript so it is pretty likely that I have messed something up. I am beginner, so just need a piece of advice before sharing the code: Do I need ...
Book Of Flames's user avatar
1 vote
1 answer
654 views

Find out whether string A can be shifted to get string B

The task: Given two strings A and B, return whether or not A can be shifted some number of times to get B. For example, if A is abcde and B is cdeab, return true. If A is abc and B is acb, ...
thadeuszlay's user avatar
  • 4,003
4 votes
2 answers
4k views

Return the first word with the greatest number of repeated letters

I'm learning JavaScript and have written a function that accepts a string and returns the first word with the greatest number of repeated letters. For example: Input:"Hello apple pie" - Output:"Hello"...
user8758206's user avatar
5 votes
1 answer
134 views

Advent Of Code 2017 Day 4 (part 2) in Functional Programming (FP)

I wanted to practice functional programming (FP) without using any library but using vanilla JavaScript only. So I took a problem from Advent of Code (the 2nd part of Day 4) You can only access the ...
thadeuszlay's user avatar
  • 4,003
1 vote
2 answers
78 views

Getting a string from a range of possible paths

I have a scenario where I need to grab the first occurrence of a string from an object, but only if the match occurs in one of the path's that have been pre-defined. ...
user2627546's user avatar
5 votes
1 answer
98 views

String checking functions in functional JavaScript

Please review these string checking functions. This is the whole module which is actually written here. It supports buffer, array...
Mas Bagol's user avatar
  • 153
1 vote
1 answer
77 views

Concat strings from Object or Array

How would you merge these two functions into a single more generic function? ...
jdsninja's user avatar
  • 177
6 votes
2 answers
140 views

Reformatting a structured string like "a-b-c|A-B-C" into "a-A|b-B|c-C"

The code below was inspired by this post in Code Review. Here is how it was first intended by its author: I have the following code that converts a string that looks like : aaa-bbb|ccc-ddd|eee-fff ...
cFreed's user avatar
  • 2,831
5 votes
1 answer
2k views

Natural sorting/comparing algorithm in TypeScript

This code sorts string that may contain numbers in natural order, that's it, "item 2" comes before than "item 10". It currently ignores case. I plan to implement options to handle case sensitivity and ...
André Werlang's user avatar
5 votes
1 answer
1k views

Converting any PHP function toString() like in JS

In JavaScript, any function is basically an object on which you can call (function(){}).toString() to get it's underlying code as a string. I'm working on a ...
Silviu-Marian's user avatar
6 votes
1 answer
2k views

BBCode to HTML converter using functional programming

I was inspired to write a BBCode to HTML converter as I'm currently learning functional programming. I wanted achieve functional cohesion. jsFiddle I'd like feedback on: structuring of the code. ...
Pete's user avatar
  • 2,314