• 0
Sign in to follow this  

Sobre Sintaxe


Ola pessoal,

Estou estudando java script e tem uma sintaxe que nunca vi no java script que é o "?" ,veja a parte de um codigo abaixo onde tem essa sintaxe e para que serve?


function ddInit(e){
topDog=isIE ? "BODY" : "HTML";

hotDog=isIE ? event.srcElement : e.target; 
while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;

E pra que serve também esse ":" no codigo?



Edited by marvi

Share this post

Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

seria o mesmo que if else, com exemplo você entenderá melhor:

valor = "5";

alert ((valor>=1)?"é maior que 1":"não é maior que 1");

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this