Yes, the Inference API is just using usual HTTP requests, so you can use Python, JavaScript or even direct curl requests to use it. You can find more about the structure of the requests at the API documentation 3.
Here 1 you can find a Gist showing how to use a table-question-answering model. It’s a good self contained example. Here would be a minimal version for bert 1. There are multiple mechanisms to make HTTP requests in JavaScript and I’m not an expert in the area, but you get the idea.
const api_url = "https://api-inference.huggingface.co/models/bert-base-uncased";
const pipeline = "table-question-answering/"
const payload = JSON.stringify({
  "query": {"inputs": "The answer to the universe is [MASK]."},
});

// Add your token from https://huggingface.co/settings/token
const body= {
    "headers" = {"Authorization": "Bearer YOUR_TOKEN"},
    "wait_for_model": true,
    "use_gpu": false,
    "method" : "POST",
    "contentType" : "application/json",
    "payload" : payload
  };

var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", api_url, false);
xmlHttp.send(body);
console.log(xmlHttp.responseText);