Software

Javascript boolean interpretation

I have two simple questions for you about boolean values in Javascript.
When will browser show alert message:

if (a-b) alert(“it’s true!”);

And another one

What will be printed as result of running this script:

for (var n=10; n; n– )
{
document.write (n + “,”);
}

The answer for both questions relies on the same principle of what JavaScript engine will evaluate as true and what as false.

Related posts:Javascript pseudo protocol (is EVIL)Javascript function context, “apply” method and lost “this” objectC# LINQ Teaser


[ Read the rest of the story in the original article... ]

Software

C# LINQ Teaser

Another great interview question.
Will the following code compile and if yes what will be the result of it ?
static void Main(string[] args)
{
int[] array = new[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

Func<int, int> func = i => {
Console.Write(array[i]);
return i;
};

var result = array.Where(e => e <= func(2)).ToArray ();
}
* There is a second part for this question, but only after you answer the first one.

Related posts:C# Inheritance QuestionC# The “double” troubleC# Byte Iteration Question


[ Read the rest of the story in the original article... ]

Facebook

Brain Buddies Remixes Popular Brain Teaser Application, Experiences Rapid Growth

They say imitation is the biggest form of flattery, so Playfish should be pretty flattered by German-based Wooga’s latest game: Brain Buddies. The application takes a similar approach to “Who Has the Biggest Brain?” but provides new forms of brain teasers. There are four alternative challenges, one of which is almost identical to one of the challenges in Playfish’s competing application. Right now the most popular strategy for success in the social gaming arena appears to be copy others and then promote.

The result has been multiple legal battles although none of them have resulted in any game changing decision…

Login