do you need semicolons in javascript code example

Example 1: do you need a semicolon in javascript

// semicolons are optional because javascript is smart to detect where a line of code ends!!!
console.log(45)
console.log(45);

// there still the same

Example 2: can you do a join() in js without the commas

arr.join("")

Example 3: when do we need & in golang

var a = 5
var p = &a // p holds variable a's memory address
fmt.Printf("Address of var a: %p\n", p)
fmt.Printf("Value of var a: %v\n", *p)

// Let's change a value (using the initial variable or the pointer)
*p = 3 // using pointer
a = 3 // using initial var

fmt.Printf("Address of var a: %p\n", p)
fmt.Printf("Value of var a: %v\n", *p)

Tags:

Misc Example