Will all the values of js return appear on console?

https://codepen.io/niusz/pen/.
when I do not enter in the input box, click the button to join the queue, why does console.log not display the return value flase?

Nov.20,2021

you must use console.log () to print.


. First of all, you need to know that return has nothing to do with console.log.

var a = function() {return false}()
console.log(a) // false

in js, we often use return false to prevent the form from being submitted or to continue with the following code, commonly speaking, to prevent the default behavior from being executed. Return false is only valid for the current function and does not affect the execution of other external functions. Return false; returns the processing result of the error and terminates the processing.


var queue = ["apple", "pear"];

    let in_btn = document.getElementById('in-btn');
    let out_btn = document.getElementById('out-btn');
    let font_btn = document.getElementById('font-btn');
    let empty_btn = document.getElementById('empty-btn');
    let queue_in = document.getElementById('queue-input');
    let queue_cont = document.getElementById('queue-cont');
    in_btn.onclick = function(){
        if(queue_in.value === ''){
          console.log(false)
            return false
        } else {
            queue.unshift(queue_in.value);
            queue_cont.innerHTML = ':' + queue.join('->');
            queue_in.value = "";
        }
    }
Menu