Advertisement
ph4x35ccb

Seção 5 aula 11 Udemy

Apr 24th, 2019
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Funçoes</title>
  5. </head>
  6. <body>
  7. <script>
  8.  
  9.     //Função Literal
  10.     function somar(n1,n2){
  11.        return n1+n2;
  12.     }
  13.     var soma = somar(10,20);
  14.     console.log("Resultado",soma);
  15.     somar.teste="propiedade da funçao";
  16.     console.log(somar.teste);
  17.     var teste = function(str){//funcao anonima
  18.         console.log('teste',str);//atribui a funçao a variavel teste
  19.     };
  20.     teste('ola');
  21.     //passando funcao por parametro
  22.     var parametro = function(f){
  23.         f()
  24.     };
  25.     parametro(function(){
  26.         console.log('funçao passada por parametro');
  27.     });
  28.  
  29. </script>
  30. </body>
  31. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement