How do I show a JS variable on the TITLE tag?

html, javascript

Solution

You can use `document.title`, like so

  var a = 30;
  var b = 1;

  var c = document.getElementById('timer').innerHTML = a - b;
  document.title = c;

Problem

``` <!DOCTYPE html> <html> <head> </head> <body> <p id="timer"></p> <script> var a = 30; var b = 1; var c = document.getElementById('timer').innerHTML = a - b; </script> </body> </html> ``` Thanks for taking your time to look at this! How would I show `VARIABLE C` inside the HTML `TITLE` tag?? so: ``` <title>SHOW WHAT VARIABLE c IS EQUAL TO</title> ``` The point for this is to make a countdown timer that will show your time in your tab so you don't have to keep checking. Also, right now it just subtracts 1, how would I make it KEEP subtracting?? THANK YOU!! I appreciate it

Original source