google+javascriptbanktwitter@js_bankfacebook@jsbankrss@jsbank






Certains JavaScript Scripting Basics Cela montre sans JavaScript tutorial vous une base JavaScript trucs et astuces pour d


�tiquette: Fonctions JavaScript, JavaScript Looping, Variables JavaScript, Fonctions JavaScript pr

G�n�rez vos vid�os d'entreprise par l'IA avec la voix ou simplement du texte



Votre premi�re application vid�o AI GRATUITE ! Automatisez votre premi�re vid�o AI. Cr�ez votre vid�o professionnelle en 5 minutes gr�ce � l'IA. Aucun �quipement ni comp�tence en montage vid�o requis. Production vid�o sans effort pour les sp�cialistes du marketing de contenu.
Application vid�o AI ILLIMIT�E gratuite � port�e de main

Javascript Variables

Variables are locations that you define you want to store information in. You use the keyword var to tell the browser you want to create a new place to store information and then assign that variable with a value. Ex. var myEmail = "[email protected]";

You can change the value of a variable at anytime, just by assigning it a new value with the equals sign. The name of your variable can contain any letter of number and it is considered good form to start the name with a lower case letter and then capitalize each word there after. Ex. thisIsANiceName

Variables created inside of functions are only accessible inside of the function in which they are declared. If you want to be able to access a variable anywhere in your Javascript program make sure that you declare it outside of a function. You should also never create two variables with the same name.

Unlike most programming languages, Javascript is what they call loosely typed. You see most languages require you to tell them what types of information you will assign to a variable. Is it a small number, a really big number, text, etc. Javascript doesn't care, except for a few instances. You can assign a number to a variable name and then text. Javascript will even convert text into a number and add it to another number, if at all possible. Ex:

var numberOne = 5; // Creates a variable named numberOne and assigns the value of 5 to it
var textTwo ="10″; // Creates a variable named textTwo and assigns the text string "10″ to it
document.writelin(numberOne + textTwo); // Would print 15 to the screen even though textTwo is technically text and not a number.

Variables that Must be Defined

Arrays

There are only two variable types that must be declared, the Array and Date data types. An array is a variable that can store multiple values. You create an array as such: var vehicles = new Array("car", "truck", "van");

The values of this array variable can now be accessed by specifying the number of the value stored in the array. The numbers are assigned from zero on up. For example:

  • The value of vehicles[0] is equal to car
  • The value of vehicles[1] is equal to truck
  • The value of vehicles[2] is equal to van

You can also add additional values to the array. For example to add "bicycle" to the array, you would type: vehicles[3] = "bicycles";

Dates

You define a date variable in the following ways:

  • var today = new Date(); // Will create a Date Variable and call the Date() function to assign the current time and date to it
  • var myBirthDay = new Date(1974, 12, 21); // Creates a Date variable and assigns my birthday to it

Javascript Pre-Built Functions & Operators

There are many pre-built functions and operators available to you with Javascript Scripting. To finish this article I'll go over a few of the most common operators for you:

  • + (Addition): Used to add numeric values or combine 2 strings of text
  • - (Subtraction): Used to subtract values
  • * (Multiply): Used to multiply values
  • / (Divide): Used to divide values
  • % (Modulus): Used to return the remainder of a division of two numbers. Ex. 15 % 7 = 1
  • ++ (Increment): Shorthand way to add one to a value.
  • - (Decrement): Shorthand way to subtract one from a value

You can also use a shorthand notation to add and then assign a value to a variable. Ex:

  • x += y: Adds x and y, then stores that value in the variable x
  • x -= y: Subtracts y from x, then stores that value in the variable x

In the looping section above we were performing comparisons. Here is a list of the ways you can compare information:

  • x == y: Tests whether x equals y
  • x < y: Tests whether x is less than y
  • x > y: Tests whether x is less than y
  • x <= y: Tests whether x is less than or equal to y
  • x >= y: Tests whether x is greater than or equal to y
  • x != y: Tests whether x is not equal to y
  • x= (y < 5) ? 10 : 15 : Shorthand way to test and then assign a value based on the test. This code tests if y<5, if the answer is TRUE then x is assigned the value of 10, if not x is assigned the value of 15

Finally, there are three operators that can be used to test further on how different values compare. These operators are referred to as logical operators and include the following:

  • if ( x < y && a > b ): && is used here to check if both comparisons are TRUE. If x < y is true AND a > b, then this comparison returns the answer TRUE. If either is not TRUE it returns the value FALSE.
  • if ( x < y || a > b ): || is used to see if just one comparison is TRUE. If one or the other or both comparisons are TRUE, then TRUE is returned, if both are untrue then FALSE is returned.
  • if (!x): This is the NOT operator. It is used to check if values are not equal to the variable it is being used on.

That's all Folks

Well that is it for now. In the next article I'll explain what objects are and how they are used in Javascript. As well I'll go into detail on how you use the Document Object Model (DOM) to jazz up your web pages.

If you have questions or comments leave them below.

Till next time...

AIVideo-App.com
Générez vos vidéos d'entreprise par l'IA avec la voix ou simplement du texte

chatGPTaz.com
Parlez à ChatGPT dans votre langue maternelle

AppAIVidéo
Votre première application vidéo AI GRATUITE

Deepfake Video
Deepfake AI Video Maker

Deepfake
Deepfake AI Video Maker

AI Deep Fake
Deepfake AI Video Maker

AIvidio
AI Video Mobile Solutions

AIvideos
AI Video Platform & Solutions

AIvedio
AI Video App Maker

Artificial General Intelligence
Ai and higher level Artificial General Intelligence (AGI)

Artificial General Intelligence
Ai and higher level Artificial General Intelligence (AGI)

Faceswap AI en ligne
Échangez des visages, des vidéos, des photos et des GIF instantanément avec de puissants outils d'IA - Faceswap AI Online GRATUIT

Faceswap AI en ligne
Échangez des visages, des vidéos, des photos et des GIF instantanément avec de puissants outils d'IA - Faceswap AI Online GRATUIT

Faceswap AI en ligne
Échangez des visages, des vidéos, des photos et des GIF instantanément avec de puissants outils d'IA - Faceswap AI Online GRATUIT

Powerful AI Presentation PPT Maker for FREE
Build an impressive presentation with our free online AI presentation app

Your next top AI Assistant
Claude AI, developed by Anthropic

Your next top AI Assistant
Claude AI, developed by Anthropic

Temu gratuit 500 $ pour les nouveaux utilisateurs
Claim Free Temu $500 Credit via Affiliate & Influencer Program

Crédits publicitaires TikTok gratuits
Maîtrisez les publicités TikTok pour le marketing de votre entreprise

Dall-E-OpenAI.com
Générez automatiquement des images créatives avec l'IA

chatGPT4.win
Parlez à ChatGPT dans votre langue maternelle

Premier produit d'intelligence artificielle d'Elon Musk - Grok/UN.com
Parlez au chatbot Grok AI dans votre langue

Outily.win
Centre d'outils ouvert et gratuit, utilisable par tous et pour tous, avec des centaines d'outils

GateIO.gomymobi.com
Airdrops gratuits à réclamer et à partager jusqu'à 150 000 $ par projet

iPhoneKer.com
Économisez jusqu'à 630 $ à l'achat d'un nouvel iPhone 16

Acheter le robot Tesla Optimus
Commandez votre robot Tesla Bot : Optimus Gen 2 dès aujourd'hui pour moins de 20 000 $

JavaScript par jour


Google Safe Browsing McAfee SiteAdvisor Norton SafeWeb Dr.Web