大神求助,JS如何实现当某个浏览器访问的时候该button 才出现

大神好,其实我是一个做网络的,对JS只会依瓢画葫芦,最近遇到一个非专业的问题,想请JS大神帮忙解答下,如果能详细点就更好了
类似于下面的效果,匹配2345则跳转到sw.html,不是则跳转jc.html
if(navigator.userAgent.indexOf('2345')==-1 ) {
window.location.replace("jc.html");
}
else
{
window.location.href="sw.html";
}


现在是这样的,希望跟上面效果类似,当匹配到2345的时候,下面的button才出现,如果不是则不出现,应该如何实现,新手一枚,求大神给个完整代码,谢谢

图片说明

var some_button = document.getElementById("id_of_button");

if(navigator.userAgent.indexOf("some_kind_of_agent")==-1)

some_button.style.visibility="hidden";

else

some_button.style.visibility="visible";
如果需要是2345就把agent那改成2345