본문 바로가기
알고리즘/Codewars

[Codewars] Remove anchor from URL (8 kyu) / JavaScript

by fluss 2023. 1. 29.

https://www.codewars.com/kata/51f2b4448cadf20ed0000386

 

Codewars - Achieve mastery through coding practice and developer mentorship

A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages!

www.codewars.com

 

DESCRIPTION:

Complete the function/method so that it returns the url with anything after the anchor (#) removed.

 

Examples

"www.codewars.com#about" --> "www.codewars.com"
"www.codewars.com?page=1" -->"www.codewars.com?page=1"
 

코드

function removeUrlAnchor(url){
  return url.split('#')[0];
}

댓글