Skip to content

Latest commit

 

History

History
24 lines (13 loc) · 579 Bytes

File metadata and controls

24 lines (13 loc) · 579 Bytes

CodeWars #6 Remove anchor from URL [6 kyu] ✅

Check out this kata

Description:

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

EXAMPLE

 // returns 'www.codewars.com'   
removeUrlAnchor('www.codewars.com#about')    

// returns 'www.codewars.com?page=1'    
removeUrlAnchor('www.codewars.com?page=1')   

My Solution:

function removeUrlAnchor(url){  
    return url.replace( /#.*/ , '' )  
}