Hi!
this is my first time using Nodejs. Have been following someone's tutorial step by step
with this example 'Hello there $(name)' is like a string and '$(name)' doesn't change color to blue and the output doesn't give variable name
Please help
I have 3 modules
1. app.js
2. 4-names.js
3. 5-util.js
this is my first time using Nodejs. Have been following someone's tutorial step by step
JavaScript:
const sayHi = (name) => {
console.log('Hello there ${name}')
}
Please help
I have 3 modules
1. app.js
JavaScript:
const names = require('./4-names')
const sayHi = require('./5-utils')
console.log(names)
sayHi(names.lebitso)
sayHi(names.surname)
sayHi(names.otherName)
2. 4-names.js
JavaScript:
//local
const secret = "SUPER SECRET"
//declaration of share variable
const lebitso = 'Tsepo'
const surname = "Tsálong"
const otherName = "Mohau"
module.exports = { lebitso, otherName, surname}
3. 5-util.js
JavaScript:
const sayHi = (name) => {
console.log('Hello there ${name}')
}
module.exports = sayHi
Last edited by a moderator: