Answers for "how to make snake in javascript"

CSS
0

how to convert string to snake case in javascript

const snakeCase = (string) => {
  const toSnakeCase = (str = "") => {
    const strArr = str.split(" ");
    const snakeArr = strArr.reduce((acc, val) => {
      return acc.concat(val.toLowerCase());
    }, []);
    return snakeArr.join("_");
  };
  const newText = toSnakeCase(string);
  return newText
};
Posted by: Guest on May-17-2022
-1

how to make a snake game

dont ask me, how would I know?
Posted by: Guest on December-08-2020

Browse Popular Code Answers by Language