RSS

LINQ In Javascript

10 Oct

By the following code you can use the LINQ in javascript.

For that you need JSLINQ.js file.

You will get it from http://jslinq.codeplex.com/releases/view/28886

<script type=”text/javascript” src=”JSLINQ.js”></script>
<script type=”text/javascript”>
function LINQInJavaScript() {
var myList = [
{ FirstName: “Chris”, LastName: “Pearson” },
{ FirstName: “Kate”, LastName: “Johnson” },
{ FirstName: “Josh”, LastName: “Sutherland” },
{ FirstName: “John”, LastName: “Ronald” },
{ FirstName: “Steve”, LastName: “Pinkerton” }
];
var whereExample1 = JSLINQ(myList).Where(function(item) { return item.FirstName == “Chris”; });
alert(whereExample1.items[0].FirstName);
</script>

 

 
Leave a comment

Posted by on October 10, 2012 in Javascript

 

Leave a comment