I am unable to understand Google chromes get and set functions.
Please refer the below code snippet.
var v1 = 'l1';
var v2 = 'l2';
storage.set({v1:'s1'});
storage.get('v1',function(result){
console.log(v1,result.v1);
});
storage.get('v2',function(result){
console.log(v2,result.v2);
});
I got the following output. l1 s1 l2 s1
I am purposely not setting v2 as I would like to understand what the result is when the variable hasn't been set yet.
I am not able to follow why get with key v2 returns s1.
Can you somebody pplease let me know where I am going wrong.
Regards, Farhan