BlogProgramming on the Toilet

PoT Episode #2: Symbols and Variables in Ruby & Destructuring in JS

By June 12, 2019 No Comments

What is it?

Programming on the Toilet is a document which contains tips, tricks, snippets or explanations about various programming technologies and paradigms, which could help developers in their everyday job. This episode was brought to you by Kenan Klisura, Lead Software Engineer at Atlantbh.

Symbols and variables in Ruby

Symbols and variables are very different things in Ruby. Symbols are like strings, they’re immutable and behave like constants. All equal symbols point to the same memory location. Variables, on the other hand, are references to some objects and can reference symbols.

Destructuring (assignment) in Javascript

Destructuring assignment is a syntax in Javascripts (ES6) that enables the unpacking of values from arrays and objects into separate variables.

Regular assignment

Destructured assignment

Want to share these tips in your workplace or at home? Download this episode of Programming on the Toilet here.