Skip to content

Instantly share code, notes, and snippets.

@ChousinRahit
Created September 3, 2023 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChousinRahit/16dad2274705336ad2061cec75dda2fb to your computer and use it in GitHub Desktop.
Save ChousinRahit/16dad2274705336ad2061cec75dda2fb to your computer and use it in GitHub Desktop.
// Convert camelCase to snake_case
// Create a function that takes a string of words (or just one word) and converts each word from camelCase to snake_case.
// Examples
// camelToSnake("magicCarrots") ➞ "magic_carrots"
// camelToSnake("greatApples for aSmellyRhino") ➞ "great_apples for a_smelly_rhino"
// camelToSnake("thatsGreat") ➞ "thats_great"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment