Javascript what does this line of code mean

use*_*393 3 javascript

Im learning Javascript, but do not know why this line is written this way. Can someone help explain why javascript is writing code like this?

What does cinnamon && (this.cinnamon = [1, "stick", "Saigon"]) mean?
I understand the first line above it. The second line seems to be doing a comparison operator with &&, but does not assign it to any variable.

      var VanillaBean = function(vanilla, cinnamon) {
      this.vanilla = [1, "bean", vanilla ? vanilla : "Madagascar Bourbon"];
      cinnamon && (this.cinnamon = [1, "stick", "Saigon"]);  //?????
    };
    VanillaBean.prototype = {
      heavyCream: [1, "cup", "Organic Valley"],
      halfHalf: [2, "cup", "Organic Valley"],
      sugar: [5/8, "cup"],
      yolks: [6]
    };
    var vanilla = new VanillaBean("Tahitian", true);
    console.dir(vanilla);
Run Code Online (Sandbox Code Playgroud)

Fré*_*idi 9

这条线:

cinnamon && (this.cinnamon = [1, "stick", "Saigon"]);
Run Code Online (Sandbox Code Playgroud)

相当于:

if (cinnamon) {
    this.cinnamon = [1, "stick", "Saigon"];
}
Run Code Online (Sandbox Code Playgroud)

短路逻辑的本质AND运营商有时会采用这种方式,因为生成的代码是不是一个完整的短if语句.

也就是说,我个人不鼓励编写这样的代码,因为它比if声明更难以阅读和维护.