I\'m building a Chrome extension and I wrote this code.
var Options = function(){};
Options.prototype = {
getMode: function(){
return ch
The chrome.storage.sync.get is called asynchronously, that's why you have to pass it a callback, so that it is executed in the future.
When you try to print the returned value of getModeyou are printing the return value of whatever chrome.storage.sync.get returns after queuing the asynchronous call to be executed.
This is a common mistake people do in javascript, while they are learning to use asynch calls.