JavaScript is a scripting language that was mainly used only in browsers a few years ago. In the meantime, JavaScript has evolved and spread, and can also be used on the server side. Today, JavaScript can even be used to program microcontrollers via special transpilers.

Code Example:

function setCookie(cookieName, cookieValue){
    if (typeof document !== 'undefined'){
        document.cookie = cookieName + '=' + cookieValue +'; path=/';

setCookie('foo', 'bar');