Discord.js give permission to a role and roles that are higher than that role

Basically, I want to make it so my JS bot gives permission to use commands if the member has a higher role than the specified role in the JS.


if(role > specifiedrole){
gives permissions
} else if(role === specified role{
gives permissions

I’m new to JS so I don’t know much.

This may/may not work and if it does work it is probably very inefficient @Vaelkarr

let specifiedrole = message.guild.roles.find(role => role.name === "Name of Role")
message.guild.roles.forEach((role) =>{
if(message.member.roles.cache.has(role.id)) {
//give permission
}else if(role.id == specifiedrole.id){

You can use role positions. I don’t know it exactly, but you can see it here.