I am novice to javascript concepts. Why i am getting the different output for the same variable length? While it is showing the expected result inside the body ?
var length;
element.all(by.className("className")).getText().then(function(items){
length = items.length;
console.log("1st output = "+length);//1
console.log("2nd output = "+items.length);//1
});
console.log("3rd output = "+length);//undefined
Output:- 1st output = 1
2nd output = 1
3rd output = undefined