Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- get_time_offset = function(timezone_id){
- Timezone.findById(timezone_id, function(err, doc){
- if(err) {
- console.log(err);
- } else {
- console.log(doc.offset);
- }
- });
- }
- get_time_offset = function(timezone_id){
- var offset;
- Timezone.findById(timezone_id, function(err, doc){
- if(err) {
- console.log(err);
- } else {
- offset = doc.offset;
- }
- });
- console.log(offset);
- }
- var scope = {offset : 10};
- get_time_offset = function(timezone_id){
- Timezone.findById(timezone_id, function(err, doc, scope){
- if(err) {
- console.log(err);
- } else {
- scope.offset = doc.offset;
- }
- });
- }
- console.log(scope.offset);
- var offset = {};
- } else {
- offset = doc.offset;
- console.log('from inside ... ', offset);
- }
- });
- }
- console.log('from outside ... ', offset);
- get_time_offset = function(timezone_id){
- var offset;
- function processResult(val) {
- console.log(val);
- }
- Timezone.findById(timezone_id, function(err, doc){
- if(err) {
- console.log(err);
- } else {
- offset = doc.offset;
- }
- processResult(offset);
- });
- }
- get_time_offset = function(timezone_id, callback){
- Timezone.findById(timezone_id, function(err, doc){
- if(err) {
- console.log(err);
- callback(false);
- } else {
- callback(doc.offset);
- }
- });
- };
- get_time_offset(5, function(offset){
- console.log(offset)
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement