Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 308 Vote(s) - 3.62 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Javascript tutorial 2

#1
I feel very bad today and i don't know how many errors i will have or how bad i will expain it but i hope you will undarstand it if you have problem ask in comments
I hope that you have undarstand part 1 in this part we will cover Functions, If...Else, Switch

Function

A function is a block of code that will be executed when somebody call it, in JavaScript functions are very used

Exaple

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

On the first line we give a name to the function (MyFunction in the example)
between {} is the body of the function (the code we what to use later[when we call the function]))
And now let's call it

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


This code is simple to undarstand i hope you deal with it

Calling function with arguments
When you call a function you can pass along some values to it these values are called arguments or parameters
example

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


Here we give values to name and name1

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


and the function work with those 2 arguments you can have 5-10 even 1235135351325 arguments on function

If...Else

if statement - use this statement to execute some code only if a specified condition is true
if...else statement - use this statement to execute some code if the condition is true and another code if the condition is false
if...else if....else statement - use this statement to select one of many blocks of code to be executed
switch statement - use this statement to select one of many blocks of code to be execute

If statment example

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


if the times is between 13 and 18 the program will alert (have a nice day)

If...else Statement

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


If its < than 20 it will alert good day if its > than 20 it will alert good evening

If...else if...else Statement


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


If the time is less than 10:00, you will get a Good morning alert if not but the time is less than 20:00 you will get a Good day alert otherwise you will get a Good evening alert

Switch
We use the switch statement to select one of many blocks of code to be executed

Example

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


Display today's weekday-name. Note that Sunday=0, Monday=1, Tuesday=2, etc

Don't forget to write break; afther each case !
Reply

#2
Quote:(01-14-2013, 11:16 AM)john001 Wrote:

[To see links please register here]

Hey there. Thanks for this great info. I have problems in using switch but now after reading this it will easily solve my problem. Thanks.

It's pleasure for me to hear that.
Reply

#3
Loving these tutorials, basic syntaxes and everything. I know other languages so I know most of how everything will look, but I don't know Javascript as an overall language. You should write more of these
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through