-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
31 lines (29 loc) · 985 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$( document ).ready(function() {
$("input").on('input',function(e){
let deger = $(this).val();
let arr = [];
let temp = 0;
let current = 1;
arr.push(temp + current)
for (let i = 1; i < deger;i++) {
let pushvalue = temp + current;
arr.push(pushvalue)
temp = current;
current = pushvalue;
}
$('#result').html('[ ' + arr.join(', ') + ' ]');
});
});
// Minimum satır denemesi
// $( document ).ready(function() {
// $("input").on('input',function(e){
// let deger = $(this).val(), arr = [], temp = 0, current = 1;
// arr.push(temp + current)
// for (let i = 1; i < deger;i++) {
// let pushvalue = temp + current;
// arr.push(pushvalue)
// (temp, current) = (current, pushvalue);
// }
// $('#result').html('[ ' + arr.join(', ') + ' ]');
// });
// });