Self-reproducing programs

Quine: a program producing its complete source code as its only output

A Python quine, using repr for escaping

a = 'a = %r\nprint(a %% a)'
print(a % a)

Same thing in JavaScript via JSON formatting

const a = "const a = %s\nconsole.log(a, JSON.stringify(a))"
console.log(a, JSON.stringify(a))