[More of a comment than an answer, but too long anyway - if you clarify your question, I will either edit the answer or delete it altogether, depending on wht exactly you want.]
Yes, if you translate it to the form that Org babel wants:
var a = 1
var b = 2
return a + b
and you load the
ob-js library. I suspect you want something else, but it is not clear to me what exactly that is from your question. Maybe you can clarify your question and specify what the Org mode file should contain and then what you'd like to accomplish.
EDIT (in response to the added information in the question): The transformations that
pandoc does between Org mode files and Markdown files are purely textual. You need an underlying execution engine in order to execute code blocks: that is provided by Org babel and Emacs for Org mode files, but there is nothing similar for Markdown files (even if you open them in Emacs). It is conceivable that an MD babel implementation could be made (e.g. code blocks are used in both cases for pretty-printing purposes, fontification, coloring etc.) but the details are sufficiently different to make it a non-trivial pursuit (e.g. there is a whole slew of header arguments that can be passed to an Org mode code block: there is nothing like that in any Markdown syntax that I know of), and although you might be able to extend MD syntax to cover some or all of what MD code blocks are missing, then you'd have to port Org babel to "MD babel" to provide the execution engine (and only in Emacs, remember). So, I think the answer to your question is: No, there is nothing like that currently.
As for how to do it in the above context (while editing the MD file in Emacs), I think the simplest thing is to keep the Org mode syntax for code blocks as is. The MD code block would be:
``` js <header-args>
where everything after the opening triple-backtick and before the closing one is just an Org mode code block without the
#+END_SRC markers. The "MD babel engine" would just replace the triple backticks with
#+BEGIN_SRC ... #+END_SRC, write the code block to a temporary file
foo.org and then open the file in Org mode and run the code block using Org babel, and then copy the
#+RESULTS block and paste it into the MD file after the code block.That should not be too difficult, but the major mode used for the MD file would have to be taught how to deal with the extra stuff (e.g. the header args and the
#+RESULTS: block) if it cared.
But then the question becomes: why do all that in MD mode? Why not do the whole thing in Org mode and export the file to MD at the end and be done with it?