What is this techinique called? : <p>I come from C#. A small example with C# syntax:</p>

<pre><code>// using System.Linq;

int[] array = { 1, 2, 3, 5 };
int result = array.SingleOrDefault(x =&gt; x % 2 == 0);
</code></pre>

<p>I want to <code>convert</code> that syntax to javascript syntax:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>Array.prototype.singleOrDefault = function (tsource) {
	var $self = this
	if ($self.length) {
  	for (let i = 0; i &lt; $self.length; i++) {
    	if (tsource($self[i])) {
      	return $self[i]
      }
    }
    return null
  }
};

var test = function () {
  var array = [1, 2, 3, 5];
  var result = array.singleOrDefault(x =&gt; x % 2 === 0)
  if (result !== null) {
  	alert(result)
  }  
};</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button onclick="test()"&gt;Click me&lt;/button&gt;</code></pre>
</div>
</div>
</p>

<p>In C#: <code>.SingleOrDefault(TSource)</code> is called <code>Linq method</code> which referenced from <code>System.Linq</code> namespace.</p>

<p>So, my question is: what is <code>.singleOrDefault(x =&gt; x % 2 === 0)</code> called in this case (in javascript)?</p>
