Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Funçoes</title>
- </head>
- <body>
- <script>
- //Função Literal
- function somar(n1,n2){
- return n1+n2;
- }
- var soma = somar(10,20);
- console.log("Resultado",soma);
- somar.teste="propiedade da funçao";
- console.log(somar.teste);
- var teste = function(str){//funcao anonima
- console.log('teste',str);//atribui a funçao a variavel teste
- };
- teste('ola');
- //passando funcao por parametro
- var parametro = function(f){
- f()
- };
- parametro(function(){
- console.log('funçao passada por parametro');
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement