Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

variable names... delta? foo? Just curious....

Sorry if this is answered in other courses, but I've just run across these names as variables pretty often and I'm just curious as to why they're used so much, or their significance... or their history?

Being 100% new to programming I feel like it's a silly question to ask, but I guess I feel like I'm often in a room where there's a joke or something everyone is getting except me! Or, it's valuable to know, idk!

1 Answer

The usage of foo is a common placeholder word, that goes way back to early software development.

It's short, easily recognizable, and intentionally lacking any particular meaning. foo is often used with bar, as they are two halves of the word Foobar — a nonsensical, phonetic pronunciation of a military acronym FUBAR (F'd Up Beyond All Repair). Kind of an inside joke that is commonly found in introductory programming lessons and pseudocode — like "Hello World".

Source: https://en.wikipedia.org/wiki/Foobar

That's great! I appreciate the insight! Thought it might be something like that.

I am humored that Treehouse would use foobar; I understand the tradition behind it, but its meaning is hardly PG. I'm more familiar with its use in the military, which I've heard as F***** Up Beyond All Recognition (vs. Sean's Repair). The wiki article on the use of foobar in programming is a very interesting read. Thanks for the link Sean.