Skip to content

Latest commit

 

History

History
87 lines (72 loc) · 1.25 KB

File metadata and controls

87 lines (72 loc) · 1.25 KB

Test case: one line string initialization

JavaScript:

var text = "hello"

Python:

text = 'hello'

Test case: string concatenation with plus sign

JavaScript:

var text = 'hello' + 'world' + 'from py'

Python:

text = 'hello' + 'world' + 'from py'

Test case: string concatenation with plus sign on many lines

JavaScript:

var text = 'hello' +
'world' +
'from py'

Python:

text = 'hello' + 'world' + 'from py'

Test case: string concatenation with plus sign with variables

JavaScript:

var text = 'hello ' + var1 + 'world' + var2

Python:

text = 'hello ' + var1 + 'world' + var2

Test case: template literal

JavaScript:

var text1 = `hello ${var1} world ${var2}`
var text2 = `${var1} World world ${var2}`
var text3 = `${var1} World ${var2} world`

Python:

text1 = f'hello {var1} world {var2}'
text2 = f'{var1} World world {var2}'
text3 = f'{var1} World {var2} world'

Test case: multiline string

JavaScript:

var text = `hello
world
from py
`

Python:

text = 'hello\nworld\nfrom py\n'

Test case: one-line with caret return string

JavaScript:

var text = "hello\nworld\nfrom py\n"

Python:

text = 'hello\nworld\nfrom py\n'