Thursday, June 30, 2022

I got more intelligent because I saw that, of course

And was one day that I was called to skies for being an genius and once there I was requesting a reward, pudding, cookies or cake, that time I forgot of ask the soda pop to drink, I wanted a party with food, and appear after a wise man of oriental land and a North-American woman, and she said her life her age and the fact of she was the mother of four kids, after listen her history the wise man advice for her that she supposes to keep her body immaculate to a future marriage that if she do it that way she would be a virgin for her husband, I thought that was grothesque but I said that he was prudent because in my mind he was saying what prudent girl supposes to do to have a virginal marriage but the advice came kind of late for the American lady that already had kids, have around the planet so much women with four kids that what was the problem of being a mother, that one day married I would not want to my wife have four kids but had a lot of men around the world that have four kids with his wife that this wasn't a problem for nobody. And he thinking that he hadn't said the enought complete with that she supposed to hide or get rid of her kids, she was listen with almost devotion like that was a religious advice, and he started to return to his home, but once he got the back for the lady she got transform in a demon, got 800 legs like octopussy legs, that was Divine inteligence that said to me the number of her legs, and she went after him that wasn't seeing those things because he was back to her, she was white like the paint white, with blue lips and other blue and purple colors around her image, and the divine intelligence said that she would live in his country for many years to afflict him, that she would hid in rocks and inside the persons of his country to chase him and despair his people.

Rute Bezerra de Menezes Gondim

JS - the meaning of that snippet

 And you probably could thought that they made the code harder to understand, but  have a reason, in a real clock the hour-pointer don't jump hours, so it doesn't passes of the 4 hour to 5 hour just jumping but will walk slowly to 5, so if we put just the calculation for the hour we would not see the hour-pointer slowly walking for the next hour but jumping for the next hour, in the school I studied the angle of the hour pointer, of course there we not use the moviment of the milliseconds the angle of the broke hours we calculated with the add of the minutes, so the full hour the hour-pointer is in the hour mark, but with the walk of the minutes the pointer-of the hours will be increasing in the direction of the next hour, so one hour is the 360° divide by the 12 hours, so is 360/12 each hour, and one minute inside that 360/12 is you have that 360/12 and add for each minutes + (360/12)/60, so you gonna add this for each minutes

1 minute =  + (360/12)/60

2 minute =  + (360/12)/60 + (360/12)/60;

15 minutes = + 15x( (360/12)/60)


  // write Hours
  ctx.rotate(hr * (Math.PI / 6) + (Math.PI / 360) * min + (Math.PI / 21600) *sec);

How in that clock we are considering the milliseconds we gonna put that info for the minutes

and in the seconds is just the milliseconds. Rute Bezerra de Menezes Gondim

Js you know the meaning of the code I marked?

 And that I didn't have to conclude!!! Is that in school when I first see that code, you don't blieve what was the acchieve at that time was the student conclude by logical what does mean, and not code, and there will the answer  that snippet that I marked I saw in the school when I was 13 years old, means that the hours would be always a number lower than 12 so the rest will be the number, if I divide to collect the rest of 6 by 12, the rest is 6, I am not looking for an broke number, so if divide 5 by 12 the result is 0 and the rest is the 5 and this for all the numbers....

  const sec = now.getSeconds();
  const min = now.getMinutes();
  const hr  = now.getHours() % 12;

Why, I don't know at that time that was a code from Germany, intelligent people see reasons that we the commons don't see, the answer was that the result is more perfect if pass for an process to assecure the reality of the number!? And was explicite in my school, so the 12 is one but only it. Rute Bezerra de Menezes Gondim

Monday, June 27, 2022

Something pretty that was in the MDN to learn

Canvas clipping and compositing

How to do randomly stars

Sunday, June 26, 2022

One example of code on MDN that I complete

 The two lines that I complete have after a coment saying that they was added

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Canvas transform</title>
    <script>
        function draw () {
            const ctx = document.getElementById('canvas').getContext('2d');
            ctx.save(); // Was missing in the original - added by Rutebmg-coder
            const sin = Math.sin(Math.PI/6);
            const cos = Math.cos(Math.PI/6);
            ctx.translate(100,100);
            let c = 0;
            for(let i=0; i<=12; i++) {
                c= Math.floor(255/12*i);
                ctx.fillStyle = 'rgb(' + c + ',' + c + ',' + c + ')';
                ctx.fillRect(0, 0, 100, 10);
                ctx.transform(cos,sin,-sin,cos,0,0);
            }
            ctx.restore();  // Was missing in the original - added by Rutebmg-coder
            ctx.transform(-1, 0, 0, 1, 100, 100);
            ctx.fillStyle = 'rgba(255,128,255,0.5)';

            ctx.fillRect(0,50,100,100);

        }
    </script>
    <style>
        body {
            background-color: aquamarine;
        }
        canvas {
            background-color: rgb(188, 138, 74);
        }
    </style>
</head>
<body onload="draw();">
    <h2>Canvas Transform</h2>
    <canvas id="canvas" width="500" height="500"></canvas>

</body>
</html>

Rute Bezerra de Menezes Gondim



Wednesday, June 22, 2022

A new product for who work with 3D

And of course to have that work the interprise also have to buy an central of computer, to keep a lot of information of computer, like that centrals that keep your information in the cloud, you have to have a central like that ones that is to hold consumers info in the cloud, and is that you make an 3D ambient for an archtetc, or a movie, but to keep that universe in the computer occupy space in your machine, but if was a movie important that have a sequency, even could be a game in a abandon house or an abandon circus in the middle of the woods, but if your client doesnt pay you for this finished the work you gonna delete all the work, and could even be an entire city or a country or a planet, but you can offer to your client hold the city for a rent in your center data bank for after 10 years create a new movie with the original city in 3D from your computer, I think worth a pitty pay to keep the city for 10 years if have the possibility to make a sequency of the movie or game. Rute Bezerra de Menezes Gondim

Ps.: Work  that way could help to do what is call acabamento fino, that is refine the original to be even more perfect, is to wood work, acabamento fino is make better the finish of the work.

Tuesday, June 21, 2022

Js - 0.0 to 1.0

And that I knew when I see in the school, that for computer language, isn't general but majoritary because have the random, but for everything but for the random, 0.0 to 1.0 means for the computer porcetagem, is that computer use 70% for you but for it is 0.7, many times the things have value but not unit, at the time I even saw about 3D enviroment and there for the computer the room is one and 400 is like 400x1, so the computer will multiply everything for the one, if is 56 is 56 multiply 1 and not axactly cm, but you can import unit for the 3D to you compare with your reality, a chair in a computer could have 80cm or 80 meter and look of the same size in the screen, you apply units isn't need is only a reality outside the computer and not inside. Rute Bezerra de Menezes Gondim

Js understanding that snippet

 

  const radgrad3 = ctx.createRadialGradient(95, 15, 15, 102, 20, 40);
  radgrad3.addColorStop(0, '#00C9FF');
  radgrad3.addColorStop(0.8, '#00B5E2');
  radgrad3.addColorStop(1, 'rgba(0, 201, 255, 0)');
  ctx.fillStyle = radgrad4;
  ctx.fillRect(0, 0, 150, 150);

And some are is (...) and other is = ...

And is because the first is a method or a function and the other is an assign a value, property or creating a variable and assigning for it a value. Rute Bezerra de Menezes Gondim



Sunday, June 19, 2022

About beauty


I think that isn't fancy that expression but that says a very truth

    "Who one day was queen (of beauty) don't want to lose the royalty."👑🌹🌹  

I don't know who said, that last line is mine, so I signed after this. Rute Bezerra de Menezes Gondim

Something about beauty that my mother said

Maybe you are thinking if you want to know, you don't know what is how can possible you know that you don't want to know? 👀 👹?

And was that someone said to her that swarty females are luck to have eyebrows with little hair in contrast with white females, that models with that characteristic got 30 years old and can keep being models because the eyes are younger, really had a lot of models that were swarty, can you think that was eyes that keep young for a longer time??? Rute Bezerra de Menezes Gondim


Saturday, June 18, 2022

You don't get poorest you get richier 10 cents

 To learn a little about linguistics, is that have the greater puller or pull-guy, he pull the colleagues carpet and pull the bag of the boss, wait will come the richness, is that pull the bag is flatter, think that pull bag is that luggage is something expensive, so in the far past in 4 centuries or + - the people carries sacs, probably the sac was the backpack of the past, so pull someone sac is pamper him carrying the weight for him. Rute Bezerra de Menezes Gondim

What I do with that when the covid passes

I have a lot of that mask, what I can do with it? It work to do finger-less-gloves or socks, or bra or panties, cut here sew here, a pocket with a ziper??? Rute Bezerra de Menezes Gondim


 

Wednesday, June 15, 2022

Ps.: This is the reason that the code is in the head...

... because of the onload, when you be around the Mozilla you gonna read in one moment that have some keys for that because the script have to be run before the HTML that is very uncommon. Rute Bezerra de Menezes Gondim

A hard to work code in JS

 This code have a not need complexity, is only good to learn events, specifically onload, but is very bad sew to learn canvas, is good to apply something like an function that says the time nd day when the user get in the page

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8"/>
    <title>Canvas tutorial</title>
    <script>
      function draw() {
        const canvas = document.getElementById('tutorial');
        if (canvas.getContext) {
          const ctx = canvas.getContext('2d');
        }
      }
    </script>
    <style>
      canvas { border: 1px solid black; }
    </style>
  </head>
  <body onload="draw();">
    <canvas id="tutorial" width="150" height="150"></canvas>
  </body>
</html>

So isn't need create an function to run the canvas, you apply directly, doing that way you had to create the event listener on load of the page, if write out of that function will have the canvas there but with the function you have to put the listener onload of the page, but is an example of how to use the onload, that is very good to run codes that want to run an data that is refresh, and will renew to everytime the page be loaded, like good day good afternoon good night depending of the time of the day our site is acesseced. Rute Bezerra de Menezes Gondim









JS - What is the advantage of use .querySelector above getElementById

And is that with the querySelector we can get elements from the HTML that we don't give an class or an id by it's type, so I don't named the div, but how I have only one div in the HTML the querySelector will get it, and it don't have id or class I said what is. 

And other I have class and id, of course in the end they do the same, in other words if you use id in the place of class and the contrary would work; but for instance the class you can pretend have 20 elements that will be changed in CSS or fetch in JS of the same way and id is like personal like an id of a human, and is for the changes that affects only the lonely element that have that id, but works you give the same id for more than one element so isn't mandatory, and this way id was used like a class, the elements doesn't even need be of the same type all 'p' or all 'div'.

Other when I study law I learn that have remissive index that is in the end of the book that went there and could find in an list in alphabetical order the defininations you have in the book, this is very need when you are studying because you can didn't understand an definition that if you don't have you don't gonna evolute in the study because the understand only gonna happens if yuo knew previously of something that is named in text, and in the Mozilla is like the same there is a reference, sometimes you know HTML, CSS, JS but don't remember all so you use it like an manual, sometimes the more efficient is who know look for because will receive an answer, I am saying that sometimes is good a person that know to find the answer for one question, also make easy the person learn with all the definition, the technical name, because yuo gonna have a faster answer cos you gonna ask for the exactly name, the problem of the remissive index is you think that will replace the study and will not , the remissive index  is just more one way for the best student evolute more and more fast then the others. Rute Bezerra de Menezes Gondim

Js - Canvas for start

By that snippet we can conclude is that canvas in JavaScript isn't a reserved word, or would not be possible use canvas to name a variable.

const canvas = document.querySelector('canvas');
const ctx = canvas.getContext('2d');
ctx.fillStyle = 'green';
ctx.fillRect(10, 10, 100, 100);

And other for text field or for an prompt in JavaScript, I was making for prompt when the number be 0, would the program stoped to ask more one number but wasn't working because that line of command:

while (sayNumber !==0)

And why because with the comparision what collect the prompt is text and not number, they have the same value but not the same type, so one thing that would help me would compare that way 

sayNumber != 0 

and this way would be true '0' == 0, another I don't know why more academic way is write keep the 

sayNumber !== 0

like this but say:

let sayNumber = Number(prompt('say a number'));

Something that I didn't tryed was while(sayNumber !== '0');

And one thing that would help yuo learn programming is notice that some commands in the examples of the Mozilla, that is complete but not friendly is that you are reading something basic, but the names are so fancy that you think that is new matter like function swap() you gonna think that is a method that you need learn but isn't, is a function like the ones that you can do, but the name was so impressive that gives that impression that is a method. Rute Bezerra de Menezes Gondim 



Friday, June 10, 2022

50 times is that a sign🙌

And something that I achieve 50 incarnations times, and was be a teenager, that rape the most beautifull woman of Europeif she was almost 60 years old, of course they were all single with no kids, they capture my admiration, women that doesn't needed a man to maintain them, I thought about each that they were inteligent, superior material than the others from their kind, is'nt fair rape a young women because she was beautiful but they were so old, a life with so much respect could have a man, all the 50 was virgen, cos that all cried said that was humiliating, one said that want so bad for me that wanted die and born again, that I considerer a declaration that demonstrated my sucess, the most ugly thing that I listen was one said that wanted got pregnant, with an old lady we have to show mightness, and superior brain they are very thorny, they have to respect you no matter she is the older, they are so cunning that you would deal with very dangerous females, but a flower never would stop of be beautiful because of the thorns. Rute Bezerra de Menezes Gondim

Sometimes is that what a boy wants

When in that incarnation that I respond for a girl that runs from a fortress to send those letters, and I write back cheating her making her think that I was another girl, sometimes is that what a boy wanted that a girl love of that way, with that intensity, with sensibility and fragility, boys aren't that way and girls treat the boys like they were made of iron, but sometimes we wanted kindness cos this the fragility, thinking in the fragility of love a girl that runs in the middle of the night from home, one day she could be caught for an evildoer and only would rest for me cry, after we married I used to sing for her, and I tune-up my voice to she smiled, and she liked. Rute Bezerra de Menezes Gondim 

Thursday, June 9, 2022

JavaScript - one reason to doesn't forgot the 'break'

First if isn't a acumulative thing, think sometimes you don't want to know if the person is fat, ugly or dumb, but if the person is fat ugly and dumb, but why doesn't forgot the break, is that if in the end you have an 'default' that could be firing you ask something that doesn't exist, and only would work if there isn't the case, without the break you can receive a message like Ok you buy mangos and I'am sorry you ask a fruit that we don't sell, imagine I don't ask if is fat, ugly and old but if is old, fat and ugly, essence... essence. Rute Bezerra de Menezes Gondim 

Wednesday, June 8, 2022

Js programming why function

This is the better reason for a function, when I satarted we sometimes write the commands the same in diferent places of the code to repeat what was doing, 

    Is that we have the initial stage and once run the code we came from a train-station to other train-station, isn't a loop that we want but in one moment return for the initial stage and a function do that for us, we write a function and put in the initial stage and put the same function in the end of the code after we achieve the end stage, of course, that inside the function have a yes-no test to if in the final stage we have a return for the beginning, isn't always what we want maybe we wanted that once run the code an choice is made and remains that way. Rute Bezerra de Menezes Gondim

Sunday, June 5, 2022

Js - The explanations

 The function random was kind of not working at all, so I replace for random for each insert, the random function is important if I had several inserts but how I have only 3 that went this way is a sort for each of the 3 inserts, I make it be shorter using the numerical size of the array in the place of the command array.length is that I won't be testing till the infinite an broke function I replace all, how I knew the size of the array all are 3 I put 3.

Another odd but needed replacement in the script - wasn't customName but customname, was presenting an error in the console,the error - customName is no shit, so I thought the shit is customname I was right it worked, but even do you need to create the variable customName to access the customname of the HTML, is this the reason that is odd. Rute Bezerra de Menezes Gondim

Js The hard skill - Almost perfect the missing is the sort

 Every click but the rest is Ok

coming next some explanations.

 <!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Silly story generator</title>
    <style>
        body {
            font-family: Arial, Helvetica, sans-serif;
            width: 350px;
            padding: 50px;
        }

        label {
            font-weight: bold;
        }
        div {
            padding-bottom: 20px;
        }

        input[type = "text"] {
            padding: 5px;
            width: 150px;
        }
        p {
            background-color: #FFC125;
            color: #5E2612;
            padding: 10px;
            visibility: hidden;
        }
        button {
            background-color: yellow;
            width: 200px;
            height: 40px;
        }

    </style>
</head>

<body>
    <div>
        <label for="customname">Enter custom name: </label>
        <input id="customname" type="text" placeholder="Tom">
    </div>
    <div>
        <label for="us">US</label><input type="radio" name="ukus" id="us" value="us" checked>
        <label for="uk">UK</label><input type="radio" name="ukus" id="uk" value="uk">
    </div>
    <div>
        <button class="randomize">Generate random story</button>
    </div>
     
     <p class="story"></p>


     <script>
         

         //1. COMPLETE VARIABLE AND FUNCTION DEFINITIONS

const customName = document.getElementById('#customname');// input/text
const randomize = document.querySelector('.randomize');// Button
const story = document.querySelector('.story');//paragraph

function randomValueFromArray(array){
  const random = Math.floor(Math.random()*array.length);
  return array[random];
}



//2. RAW TEXT STRINGS

const storyText = "It was 94 fahrenheit outside, so :insertx: went for a walk. When they got to :inserty:, they stared in horror for a few moments, then :insertz:. Bob saw the whole thing, but was not surprised — :insertx: weighs 300 pounds, and it was a hot day.";

const insertX = ['Willy the Goblin','Big Daddy','Father Christmas'];
let random = Math.floor(Math.random()*3);
function randomValueFromArray(array){
  random = Math.floor(Math.random()*array.length);
  //return array[random];
  return random;
}
// alert(random);
const insertY = ['the soup kitchen','Disneyland','the White House'];

const insertZ = ['spontaneously combusted','melted into a puddle on the sidewalk','turned into a slug and crawled away'];

let newStory = storyText;

let xItem = insertX[random];
// alert('bosta');
// alert(xItem);



// -----here

newStory = newStory.replaceAll(':insertx:',xItem);
let random2 = Math.floor(Math.random()*3);
let yItem = insertY[random2];
newStory = newStory.replace(':inserty:',yItem)
// alert(yItem);
let random3 = Math.floor(Math.random()*3);
let zItem = insertZ[random3];
// alert(zItem);
newStory = newStory.replace(':insertz:',zItem);




//alert(insertX.map(test))



// let modern = storyText.replace(':insertx:','Hold there');
// alert(insertX.filter(randomValueFromArray));



//3. EVENT LISTENER AND PARTIAL FUNCTION DEFINITION
//alert(12);
//const name = 'Denver';


randomize.addEventListener('click', result);
//alert(7);




function result() {



//alert(11);
   
  if(customname.value !== '') {
      const name = customname.value;
      newStory = newStory.replaceAll('Bob',name);


  }

  if(document.getElementById("uk").checked) {
    const weight = ((Math.round(300))/14).toFixed(1);
    const temperature =  (((Math.round(94)) - 32)*5/9).toFixed(1);
   
    newStory = newStory.replaceAll('94 fahrenheit',`${temperature} centigrades`);
    newStory = newStory.replaceAll('300 pounds', `${weight} stones`);


   

  }
  story.style.visibility = 'visible';
  story.textContent = newStory;// modern;
 
 
}

     </script>
   
</body>
</html>

Rute Bezerra de Menezes Gondim




Thursday, June 2, 2022

Js - A snippet of code explained

        for(let product of products){
            const subArray = product.split(':');
            const name = subArray[0];
            const price = Number(subArray[1]);
            total += price;

And what means that snippet, for beginning I thought that are create an matrix but not, what happens is that, the for will make all the product inside the array products, be stayed in the program and so the array have 5 products that in the for is used an variable that I declare right in the parentehses of the 'for', so I made product that you see I have to declare let, will be every element of the products, why? Because this is the for...of, here I have a very simple structure that will run all the elements of the array without I need say the size of the array, making very simple if you already understand what is an for....of, or would be that way for (let i=0; I<=products.length; i++) {products [I];} this way I have an structure that run all the array by each element of the array.

First let me say that product is an local variable, that will just run inside the for, out of the for isn't product is products[0], products[1] ...., so the product is an invention that runs the machine for me for a structure very simple. 

And what happens inside the for I declare ->cons subArray = product.split(':') -> You might think that I create an matrix with subArray[0][0] and so on, but not here I create an array every element with only 2 elements, so I create 5 times one array named subArray with only two elements, one the name and other the price, so just bellow still inside the for I declare const for name and const for price, so I five times create an subArray and extract the 1st element for the name and the second element for the price and this will be store all the time, the next isn't erasing the previous but being replacing in the next li until the end.

If was a matrix the pants will be the product[0][0], but the socks would be the[1][0] they combine in the last index but not in the 1st so doesn't work unless, unless you create an more hard to do structure of for that after you create the matrix make another for that runs all the matrix but catch the index by the second index is like products[i][n] so I run one and run all that have inside the first index to catch an specific second index, much harder of do.

Rute Bezerra de Menezes Gondim





Help yourself in Brazil is the same?

Is someone that is asking, let me say that I think that is Brazillian coping Americans, but many times the person in Brazil isn't being polite, see in the house of your friend could have others inhabitants, and is so common in Brazil crazy people live in their families that you can be attacked because you are walking very freely in the kitchen, what you think of the idea of be attacked by an insane? Have other was in school and a student invited a college to his home and there had a dog in the kitchen, almost attacked the visitant kid, the worst history that I listen was a girl that was molested in the kitchen of his friend by the grandmother of the owner of the house, I thought was the worse history that someone could say about 'you are of the family went to the kitchen', of course, I thought that the girl of the history was very stupid of don't run from an old, crazy woman. I think that is very natural you say help yourself when you are saying you have courage to drink in my house I live in a pigsty, so went to the kitchen and see how is dirty and you are thinking in drink water, this way the person even is being sincere and have charity, I knew the girl, sometimes I think is this or the sister, two stupid cheaters and thieves I even don't like who stay listening their history they are so prejudicial lying about the persons, they like to lie and in my mind who listen lies is more prostitute than the prostitute we cure the liers saying in its face you are a lier if have something that you can say in the face of someone is that the person is a lier of course if this is the true if you buy lies one day you can be a maiden with a fame more prostitute than the woman that was rape in a kitchen by the grandmother of her friend, so one day that you be in the church praying because people is lying about you think if one day you was a person buying lies from someone, she and her sister are sick women I think about the smartness of the rape one the day that you need be intelligent you hold still.

Rute Bezerra de Menezes Gondim

Wednesday, June 1, 2022

Js A tough code explained

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Istring exercises 2</title>
</head>
<body>

    <section class="output">
        <h1>Live output</h1>
        <input type="text" name="thisIs" id="here"><button>Search</button>
        <ul>

        </ul>
    </section>

Inside the body is create 3 elements with HTML, and is an section that will have all the elements, because we gonna name the section to identify all the elements in the Js,

What was create in HTML: a section that have inside the 1)input of the type text 2)Button 3)ul - unordered list.

The section is named "output";

    <script>
        const list = document.querySelector('.output ul');
        const searchInput = document.querySelector('.output input');
        const searchBtn = document.querySelector('.output button');

In this part we are already inside the script (Js) and we make here 3 variables for out 3 elements, we find the ul by his parent and calling the ul .output -> is the name of the parent and after is write what depedent element of the output we talking about that is the ul, and of this way for the others so if I say '.output input' I am saying about the ul that have inside of the .output; and if I say '.output button' I am saying about the button that have inside the element that I create the class output (.output is because I create the class output inside the tag of that element if we had #output instead of have create a class we would have create an id).

        list.innerHTML = '';

        const myHistory = [];
        const MAX_HISTORY = 5;

in the 1st line we empty the interior of the list, the list is in the HTML the ul, 

in the second line we are creating an array that at that time is still empty.

In the third line we create an variable that we gonna use to inside our function to say that if our array be higher than 5 will pop the 'array element' that is in the bottom, we could say if myHistory >=5 pop, but was choice put the 5 inside an variable.

     searchBtn.onclick = () => {
            // we will only allow a term to be entered if the search input isn't empty
            if (searchInput.value !== '') {
                myHistory.unshift(searchInput.value);

Here was started out function this is one different way to create an function

the common is say function functionName () {block-code}

This searchBtn that in a variable that we already iniciate and is about the button that was create in the HTML, follow by an dot, that we could already notice that we say the variables and dot their method, that here is onclick, 

So until now we create an function that is searchBtn that is about the button of our document, so we create an function for our button, and onclick is what ignite the function of the button we don't only have click could be hover, 

we have after  =(); an function is function something() so an function have an parenthensys, so =() only could means that what came before is an function so I say that and point an parentheses to say that is an function; => is point to what is the function.

So I say something and point what this something is (an function) and after I point what this do.

So 1st I will say that value !== '', this is to say that my function only work if the value is different of nothing, if the button be clicked without a value how don't gonna have an else the button will do nothing so inside my function we only have function for the button if in the searchInput be entered something. 

So after is saying that myHistory that is my array will receive in the top of it what the user type in the searchInput, so the user write something in the input and push the button and what the user had typed in the input will be used after the button be clicked

                // empty the list so that we don't display duplicate entries
                // the display is regenerated every time a search tem is entered.
                list.innerHTML = '';

What is that line, and this is the tough part of the code because don't work write directly that put every single typing of the user because, will be work this way when the user type the second will be showed in our search list the second but also the first, so we can't write for each, we gonna erase all the time what is typed in the list instead of put inside itens of the list, so what we gonna do we gonna erase all the list everytime and place fill the items with the array all the time that gonna will look like that is writing every line at that time that the button is pressed but everytime the button is pressed we had empty our list and filled with all the elements of the array so we are erasing everything all the time but this isn't what look like

                //loop through the array, and display all the search terms in the list
                for (const itemText of myHistory) {
                    const listItem = document.createElement('li');
                    listItem.textContent = itemText;
                    list.appendChild(listItem);
                }

And this that is inside our function and came after we empty our list is the part of the code that we gonna present all the elements of the array in the screen, so the elements are also in the array, and all the clicks will make an loop that after erased what previously was inside the list, will be place what inside the array,  so the array is a monolito and the list is that way we erase all to write again more the last element, so you see that we gonna need an loop that we acquieve with an for, that for do almost all that we need so this is the solution, so the for will say all the elements if the array because is that what is said inside the parentheses (), and what is in the brackets {} is what I want to happens when we are saying what inside the array, here the counter is the size of the array because until we have elements in the array we gonna execute what is inside the brackets so one time we gonna have only one element so will performed once, other two so twice, in one time we gonna have 4 and will do that when our clock that is all the elements of the array be 4 will do this way, will create an 'li' for the 1st, will fill its context, will append this to the list, but we already have a 2nd so this steps will be executed again, so will create an 'li' and after will be filled with the itemText that is declared in the parethenses that is the each lonely one and after this will be append in the list, but we have the 3rd and all that 3 steps will be done again, an we have the 4th and all those sptes will be repeat for that too.

                // If the array length is 5 or more, remove the oldest search term
                if (myHistory.length >=MAX_HISTORY) {
                    myHistory.pop();
                }

And this if is inside the other if and not after, and this if do that it will pop out of the array one element of the bottom after we reach 5 elements, so we only gonna have 5 elements because our array receive more one item but one of the bottom gonna be remove.

And this way we are writing in the array and the array is writing in our list.

                // empty the search input and focus it, ready for the next term to be entered
                searchInput.value = '';
                search.focus();
            }
        }
    </script>

So to end that code the first code line after the first line that is a comment we say that everytime we click our button the searchField that in the document is the entry that we write what we gonna search will be empty, if we don't do this way the user after click the button gonna have to delete what is in the box to write the new value. And the last code line when say focus is means that the user don't have to click with the cursor of the mouse in the field the text, the focus will be there and after click the button the cursor will be inside the text field and you just have to write in the keyboard without need before put the cursor inside the field is already there. Rute Bezerra de Menezes Gondim