首頁 >後端開發 >php教程 >探討:js與php中三等號(===)和雙等號(==)的區別

探討:js與php中三等號(===)和雙等號(==)的區別

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原創
2016-07-25 08:57:061111瀏覽
  1. <script></li> <li>var priceOfApple = "3元"; // 苹果的价格</li> <li>var priceOfBanana = "3.5元"; // 香蕉的价格</li> <li>priceOfApple = parseInt( priceOfApple ); // 解析苹果的价格</li> <li>var priceOfBanana2 = parseInt( priceOfBanana ); // 解析香蕉的价格</li> <li>if( ( priceOfApple===3 ) && ( priceOfBanana2 === 3 ) // 检查解析是否成功</li> <li>&& ( parseFloat( priceOfBanana ) ===3.5 ) ) </li> <li>{</li> <li>alert( "苹果的价格:" + priceOfApple // 输出水果的价格</li> <li>+ "n香蕉的价格的整数部分:" + priceOfBanana2</li> <li>+ "n香蕉的价格:" + parseFloat( priceOfBanana ) );</li> <li>}</li> <li></script>
复制代码


陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn