小计算问题

Vel*_*tar 4 javascript jquery

我有一个javascript计算的小问题.我有这样的功能:

$( "#main-nav li[class]" ).each(function( index ) {
     var position = $(this).offset();
     var width = $(this).width();
     var center = parseInt(position) - (parseInt(width) / 2);
     console.log("Position: " + position.left + ", width: " + width +  ", center: " + center);
});   
Run Code Online (Sandbox Code Playgroud)

但它导致了这一点.任何人都知道如何进行计算?

Position: 722, width: 83, center: NaN 
Run Code Online (Sandbox Code Playgroud)

Pra*_*man 7

position.left

$( "#main-nav li[class]" ).each(function( index ) {
     var position = $(this).offset();
     var width = $(this).width();
     var center = parseInt(position.left) - (parseInt(width) / 2);
     console.log("Position: " + position.left + ", width: " + width +  ", center: " + center);
}); 
Run Code Online (Sandbox Code Playgroud)