DEV Community

Discussion on: Use $ & $$ Instead of document.querySelector/All in JavaScript without jQuery

Collapse
 
joelnet profile image
JavaScript Joel • Edited

Yep, it would look like this:

const username = 'johndoe'
const age = 32

console.log(`The name of the user is ${username} and his age is ${age}.`)
console.log(`Element is: ${$('#article-reaction-actions')}.`)

The outer $ in the template string will start the evaluation. the $ inside of ${} will refer to the global $.

Hope this clears it up!