I'll give you the following example, where you can notice that to modify
the value of an input and showing the date, for example; you have it
do through the value method.
In the date variable, I create a new instance of new Date()
now with the variable date access to getFullYear()
to obtain the year
now with the variable date access to getMonth()
to get the month
now with the variable date access to getDate()
to get the day
To insert the dynamic value into the input, first I get it to
through its id and assign it to the variable sign ; then I do
that variable sign accesses the value method and I declare that this is
equal to my day, month and year
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<input type="text" id="fecha">
<script>
const letrero = document.querySelector("#fecha")
const fecha = new Date();
let anio = fecha.getFullYear()
let mes = fecha.getMonth()+1
let dia = fecha.getDate()
if(dia < 10){
dia='0'+dia
}
if(mes < 10){
mes='0'+mes
}
letrero.value = '${dia} / ${mes} / ${anio}'
</script>
</body>
</html>
The use of template strings is to be able to print dynamic values
with text strings without using the plus sign; What you need is the
use of inverted quotes and dynamic values or better
known as variables go with $ and between simple keys
As notes I add one to the month, this happens because JS reads the months
as an array and start from zero position, then you have to
add one to match the month in which you are running the code
I added only two conditionals (if), so that the day and month is less than 10 I added a zero at the beginning and instead of reading 4/4/2018 , we read > 04/04/2018