So I wrote the below using VSCode and executed in the node.js terminal
let city = "Belgrade,"
let country = "Serbia"
let location = city + ', ' + country
Apparently nothing works it goes like this.
It looks like application worked perfectly well. You executed the node interpreter in the shell. So, the node engine took over, created 3 variables, then quit. Node does not output each statement it runs like a shell script does, so you would not see anything from the console unless you explicitly told it to do so. If you want to output to the console, you can simply use the console.log()
function or one of its variants (you can find more information https://developer.mozilla.org/en-US/docs/Web/API/Console/log ). So try explicetely outputting your information to the console:
let city = "Belgrade," let country = "Serbia" let location = city + ', ' + country console.log(location)
Assignment only will not display the results. You need to print them out for displaying the values in the terminal.
console.log(city);
console.log(country);
console.log(location);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.