Is it appropriate to use a note box to show outcome of a code example?
No. A note box is used for a useful note containing supplementary information about a section, and aside if you like. You don’t put information that is part of the central flow of the text into notes.
You can read about the live sample system on MDN to find out how you can display the results of a code example that’s in the text.