JSFiddle - React, Tailwind, and code Playground

JavaScript

var url = "smartphones?marca=3";
alert(url.replace(/.+\?/g, ""));