title: Nodejs window undefine
body: <p>How to solve <strong>ReferenceError: window is not defined</strong>? this is my code</p>
  <pre><code>  let timestamp = new Date();
    var str = params.email;
    var enc = window.btoa(str);
    var dec = window.atob(timestamp);
    console.log(window)
    if (window == &quot;undefine&quot;){
      var template = handlebars.compile(html);
      var htmlToSend = template({email:enc + &quot;|&quot; + dec});
      var mailOptions = {
        from: 'support@google.com',
        to: params.email,
        subject: 'Sending Email using Node.js',
        html: htmlToSend
      };
  </code></pre>
  <p><a href="https://i.stack.imgur.com/tYQcV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tYQcV.png" alt="enter image description here" /></a></p>