endpoint js

JavaScript
const addEndPoint = (string) => {
  const str = string.trim();
  if (str.substr(-1) == ".") return str;

  return `${str}.`;
};
Source

Also in JavaScript: