24 grep in javascript

Solutions on MaxInterview for 24 grep in javascript by the best coders in the world

showing results for - " 24 grep in javascript"
Maximilian
12 May 2016
1<!doctype html>
2<html lang="en">
3<head>
4  <meta charset="utf-8">
5  <title>jQuery.grep demo</title>
6  <style>
7  div {
8    color: blue;
9  }
10  p {
11    color: green;
12    margin: 0;
13  }
14  span {
15    color: red;
16  }
17  </style>
18  <script src="https://code.jquery.com/jquery-3.5.0.js"></script>
19</head>
20<body>
21 
22<div></div>
23<p></p>
24<span></span>
25 
26<script>
27var arr = [ 1, 9, 3, 8, 6, 1, 5, 9, 4, 7, 3, 8, 6, 9, 1 ];
28$( "div" ).text( arr.join( ", " ) );
29 
30arr = jQuery.grep(arr, function( n, i ) {
31  return ( n !== 5 && i > 4 );
32});
33$( "p" ).text( arr.join( ", " ) );
34 
35arr = jQuery.grep(arr, function( a ) {
36  return a !== 9;
37});
38 
39$( "span" ).text( arr.join( ", " ) );
40</script>
41 
42</body>
43</html>
44
similar questions
queries leading to this page
24 grep in javascript