Javascript 请解释这行js代码。

Javascript 请解释这行js代码。,javascript,Javascript,我有以下javascript代码块,对此不是很清楚: var level = this.getLevelForResolution(this.map.getResolution()); var coef = 360 / Math.pow(2, level); var x_num = this.topTileFromX < this.topTileToX ? Math.round((bounds.left - this.topTileFromX) / coef) : Math.round(

我有以下javascript代码块,对此不是很清楚:

var level = this.getLevelForResolution(this.map.getResolution());
var coef = 360 / Math.pow(2, level);

var x_num = this.topTileFromX < this.topTileToX ? Math.round((bounds.left - this.topTileFromX) / coef) : Math.round((this.topTileFromX - bounds.right) / coef);
var y_num = this.topTileFromY < this.topTileToY ? Math.round((bounds.bottom - this.topTileFromY) / coef) : Math.round((this.topTileFromY - bounds.top) / coef);
var-level=this.getLevelForResolution(this.map.getResolution());
var coef=360/数学功率(2级);
var x_num=this.topTileFromX

这是一个JavaScript三元运算符,
的作用是什么。看

var x_num=this.topTileFromX
等价于下面的表达式

var x_num;

if (this.topTileFromX < this.topTileToX )
{
    x_num= Math.round((bounds.left - this.topTileFromX) / coef);
}
else
{
    x_num= Math.round((this.topTileFromX - bounds.right) / coef);
}
var x_num;
if(this.topTileFromX
变量x_num=this.topTileFromX
这是一个较短的if语句。这意味着:

var x_num;

if(this.topTileFromX < this.topTileToX)
{
   x_num = Math.round((bounds.left - this.topTileFromX) / coef);
}
else
{
   x_num = Math.round((this.topTileFromX - bounds.right) / coef);
}
var x_num;
if(this.topTileFromX
“@TimMedora,我想他在用英语表达方面有困难。我对问题进行了编辑以使其更清楚。谢谢。我的语言不是英语
var x_num = this.topTileFromX < this.topTileToX ? Math.round((bounds.left - this.topTileFromX) / coef) : Math.round((this.topTileFromX - bounds.right) / coef);
var x_num;

if(this.topTileFromX < this.topTileToX)
{
   x_num = Math.round((bounds.left - this.topTileFromX) / coef);
}
else
{
   x_num = Math.round((this.topTileFromX - bounds.right) / coef);
}