JS beginner here. I am trying to save the date that a user will make when using the date type input element. Input successfully is successfully stored when I place the input within the eventListener function. When I try to access input outside the value I receive an error or undefined depending on how I try to fix this. How can I access the var 'input' outside the eventListener function and successfully log input within appController?
let domStrings = {
userDate : document.querySelector('#userDate')
}
let input;
appController();
function appController(){
listen()
console.log(input);
}
function listen(){
domStrings.userDate.addEventListener('change', function(){
input = domStrings.userDate.value;
})
//return input;
}