หน้าบ้าน
เว็บบอร์ด
Icebox
Game
เข้าสู่ระบบ
Text Tool
Regex
JSON
Diff
Ascii Draw
CSS Tool
Image Tool
View
Side by side
Inline
Whitespace
ไม่สนช่องว่าง
Original
function greet (name) { const text = 'Hello, ' + name console.log(text) return text } greet('น้องอัน')
Changed
function greet (name, lang = 'th') { const text = lang === 'th' ? 'สวัสดี ' + name : 'Hello, ' + name console.log(text) return text } greet('น้องอัน', 'th')
สลับ
ตัวอย่าง
ล้าง
+3
−3
7 → 7 บรรทัด
1
function greet (name) {
1
function greet (name
, lang = 'th'
) {
2
const text = 'Hello, ' + name
2
const text =
lang === 'th' ? 'สวัสดี ' + name :
'Hello, ' + name
3
console.log(text)
3
console.log(text)
4
return text
4
return text
5
}
5
}
6
6
7
greet('น้องอัน')
7
greet('น้องอัน'
, 'th'
)