The result of a script is the last expression being evaluated. So in your example you could use:
chrome.tabs.executeScript( null, {code:"var x = 10; x"},
function(results){ console.log(results); } );
This will log [10] to the extension's console.
results is actually an array of values because if the page has more than one frame you can specify that the script should be injected in each one of them and get the result of all injections. See the specification for executeScript. If you don't specify allFrames: true, then results will always be a single element array.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…