Skip to content

Tag: arrays

How can I split strings of an array by backslash?

sIn my Gatsby project, I am picking up the following data from my WordPress platform: I am processing the coordinates string by splitting it up by pipe (|) and shifting away the first element of the array. See below: That mapping of the object is producing the following: I would like to split the elements of …

Typescript concat two data types array in one

How do I concat two types array in one array using concat. If I initialize it with two data types it works fine but when I concat it. Typescript throws an error that both types are incompatible. Answer I think it has to do with the implementation of .concat() in Typescript. It is implemented as the type of th…

Double question javascript functions with arrays

This is a double question because I can just post once every 90 minutes. First I have to write a function that replaces a character of a string. And puts a space in place of the chosen character. I tried this but is not working. It returns just the same string. And the second thing is that I have to