數字(Numbers)和字串 (String)之間,會因應一些條件的不同而processing 的處理效果亦會不同。
首先,最簡單的兩個數字相加:
let a = 5;
let b = 8;
let c = a + b; (c的數值會是 13)
但當兩個字串相加時:
let a = "5";
let b = "8";
let c = a + b; (c的值會是 "58")
若果一個數字加上字串呢?
let a = 5;
let b = "8";
let c = a + b; (c的值會是 "58",兩組都會轉變成字串看待)
若果一個字串加上數字呢?
let a = "5";
let b = 8;
let c = a + b; (c的值會是 "58",兩組都會轉變成字串看待)
立即聯絡我們
首先,最簡單的兩個數字相加:
let a = 5;
let b = 8;
let c = a + b; (c的數值會是 13)
但當兩個字串相加時:
let a = "5";
let b = "8";
let c = a + b; (c的值會是 "58")
若果一個數字加上字串呢?
let a = 5;
let b = "8";
let c = a + b; (c的值會是 "58",兩組都會轉變成字串看待)
若果一個字串加上數字呢?
let a = "5";
let b = 8;
let c = a + b; (c的值會是 "58",兩組都會轉變成字串看待)
立即聯絡我們