Narcissist: Difference between revisions

Adding a JS implementation (based on my quine)
(→‎{{header|Tcl}}: Added a "purer" way to do this)
(Adding a JS implementation (based on my quine))
Line 21:
Based upon the quine.
<lang c>extern void*stdin;main(){ char*p = "extern void*stdin;main(){ char*p = %c%s%c,a[300],b[300];sprintf(a,p,34,p,34);fgets(b,300,stdin);putchar(48+!strcmp(a,b)); }",a[300],b[300];sprintf(a,p,34,p,34);fgets(b,300,stdin);putchar(48+!strcmp(a,b)); }</lang>
 
=={{header|JavaScript}}==
{{works with|SpiderMonkey|1.7.0}}
Based upon [[Quine#Using_eval|one of the quines]].
<lang javascript>var code='var q=String.fromCharCode(39);print("var code=" + q + code + q + "; eval(code)" == readline() ? 1 : 0)'; eval(code)</lang>
 
=={{header|Tcl}}==
Anonymous user