This is an opinionated and incomplete Cheat Sheet for developers familiar with C# who are learning JavaScript.

I have been working with JavaScript for the last year or so, and created this Cheat Sheet in the process.

String.IsNullOrEmpty

C#:

string.isNullOrEmpty(s);

JS:

_.isEmpty(s);

lodash:isEmpty

String.IsNullOrWhitespace

C#:

string.isNullOrWhitespace(s);

JS:

_.isEmpty(_.trim(s);

lodash:isEmpty lodash:trim

LinQ Select

C#:

var l = new List<int>{1,2,3};
l.Select(i => i * 2);
// => 2,4,6

JS:

_.map([1, 2, 3], i => i * 2);
// => 2,4,6

lodash:map

LinQ Where

C#:

var l = new List<int>{1,2,3};
l.Where(i => i % 2 != 0);
// => 1,3

JS:

_.filter([1, 2, 3], i => i % 2 !== 0);
// => 1,3

Lodash:filter

LinQ Any

C#:

var l = new List<int>{1,2,3};
l.Any(i => i % 2 != 0);
// => true

JS:

_.some([1, 2, 3], i => i % 2 !== 0);
// => true

Lodash:some

List Contains

C#:

var l = new List<int>{1,2,3};
l.Contains(2);
// => true

JS:

_.has([1, 2, 3], 2);
// => true

Lodash:has