Guest User

Untitled

a guest
Feb 8th, 2019
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <html>
  2. <head></head>
  3. <body>
  4. <h2>Exemplu cautare</h2>
  5. <script>
  6.  
  7. function test(){
  8. console.log('acesta este un test');
  9. }
  10. test();
  11. test();
  12.  
  13. var emailuri = ['ion@gmail.com', 'iion@yahoo.com', 'ion@hotmail.uk', 'kek@lol.ro', 'alina@yahoo.com'];
  14.  
  15. var note = [10, 3, 9, 8, 9, 7, 10, 6];
  16.  
  17. console.log('emailurile sunt: ', emailuri);
  18. console.log('notele sunt: ', note);
  19.  
  20. var x = 'kek@lol.ro';
  21.  
  22.  
  23. var gasit = emailuri.includes(x);
  24.  
  25. if(gasit){
  26. console.log('DA');
  27. }else{
  28. console.log('NU');
  29. }
  30.  
  31. // TODO: exact aceeasi chestie si pentru note
  32. var notaCautata = 5;
  33. var gasita = false;
  34.  
  35. for(var i=0; i<note.length; i++) {
  36. if(note[i] == notaCautata)
  37. gasita = true;
  38. }
  39. if(gasita) {
  40. console.log('exista');
  41. } else
  42. {
  43. console.log('nu exista');
  44. };
  45.  
  46. // TODO: cum am putea simplifica codul a.i. sa nu facem un for si un if de fiecare data cand cautam ceva intr-un array?
  47.  
  48.  
  49. </script>
  50. </body>
  51. </html>
Add Comment
Please, Sign In to add comment