Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

[Dúvida] Porque deve remover as aspas simples?

nao entendi o porque de remover as aspas simples se na aula foi usada

quando vou testar tambem ocorre erro de sintaxe

    let mensagemDeBoasVindas = 'Boas vindas ao App'

alert('mensagemDeBoasVindas')

1 resposta
solução!

Levi,

Funciona assim:

Se você colocar qualquer coisa dentro da função "Alert()" COM aspas simples ou duplas ele exibirá o TEXTO que está dentro das aspas: Exemplo:

alert("Eu sou um alert!");

Mas se você criar uma variável e a mesma variável atribuir a ela um texto, exemplo:

let varTexto = "Eu sou outro alert";
alert(varTexto);

O conteúdo da variável será exibido. Sacou a diferença?

Por favor, leia mais em:

==============================================

Alert em JavaScript

Aprenda nesse artigo os diferentes tipos de alert em JavaScript e conferir como inserir eles em nosso código, deixando nosso sistema/site com uma interação maior com o usuário.

<!DOCTYPE html>
<html>
<head>
<title>Tutorial de Alert em JavaScript - Linha de Código</title>
<script>
function funcao1()
{
    alert("Eu sou um alert!");
}
</script>
</head>
<body>

<input type="button" onclick="funcao1()" value="Exibir Alert" />

</body>
</html></div>

https://www.devmedia.com.br/alert-em-javascript/37208

==============================================

Window: alert() method

window.alert() instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog.

Under some conditions — for example, when the user switches tabs — the browser may not actually display a dialog, or may not wait for the user to dismiss the dialog.

alert()
alert(message)

https://developer.mozilla.org/en-US/docs/Web/API/Window/alert

==============================================

JavaScript alert()

The alert() method in JavaScript is used to display a virtual alert box. It is mostly used to give a warning message to the users. It displays an alert dialog box that consists of some specified message (which is optional) and an OK button. When the dialog box pops up, we have to click "OK" to proceed.

<html>  
   <head>     
      <script type = "text/javascript">  
            function fun() {  
  
  
               alert ("This is an alert dialog box");  
            }  
      </script>       
   </head>  
     
   <body>  
      <p> Click the following button to see the effect </p>        
      <form>  
         <input type = "button" value = "Click me" onclick = "fun();" />  
      </form>       
   </body>  
</html>  

https://www.javatpoint.com/javascript-alert

==============================================

Função alert() e console.log()

Publicado 4 anos atrás, em 21/11/2019

https://cursos.alura.com.br/forum/topico-funcao-alert-e-console-log-96509

==============================================

Por favor, se sua dúvida foi sanada, feche o tópico e se a minha resposta foi a melhor de todas e realmente te ajudou, não esqueça de marcar a minha resposta como a melhor e me pontuar... eu adoro esses pontinhos, eles aumentam minha autoestima... muito obrigado!

[]'s,

Fabio I.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software