Variables and Functions

What is a function?

– Functions are the central working units of JavaScript. A function is written as a code block (inside curly { } braces), preceded by the function keyword. The code inside the function will be executed when “someone” calls the function. The function can be called directly when an event occurs (like when a user clicks a button), and it can be called from “anywhere” by JavaScript code.

What is a passing parameter?

– Parameter is when you call a function, and you pass along some values to it. These values are called parameters ir arguments. These can be used inside the function. You can send as many arguments as you like, separated by commas (,) And also the variables and the arguments must be in the expected order.

Example: 

<button onclick=”myFunction(‘Harry Potter’,’Wizard’)”>Try it</button>

<script>
function myFunction(name,job)
{
alert(“Welcome ” + name + “, the ” + job);
}
</script>

What is a variable compared to a value? Give an example.

e.g. x=8

y=9

z=x+y

From the expression z=x+y above, we can calculate the value of z to be 17. We called these letter variables. While value is just the number like x=8, “8” is the value in this case. There are many types of JavaScript variable, for example text value (shape = “circle”). This text value called a string in JavaScript. When you use a text value to a variable, put double or single quotes around the value. When you use a numeric value to a variable, do not put quotes around the value. If you put quotes around a numeric value, it will be treated as text.

JavaScript Data Types

1. What is a String Data Type in JavaScript?

– A string is a variable which stores a series of characters like “John Doe”.

– A string can be any text inside quotes. You can use single or double quotes.

– You can use quotes inside a string, as long as they don’t match the quotes surrounding the string.

2. Give 3 examples of data considered as String.

– ar msg=’Result’;

– var num1=’3′;

– var app=’Whatsapp’;

3. What is an Integer Data Type?

– A data type which represents some finite subset of the mathematical integers.

4. Give 3 examples of data considered as Integer.

– var num1=13;

– var num2=33;

– var num3=23;

5. What is a Floating-point value?

– Floating-point numbers are like real numbers in mathematics, for example, 3.14159, -0.000001. Java has two kinds of floating-point numbers: float and double

7. Give 3 examples of data considered as Floating-point numbers.

– var num1=300.234;

– var nem2=5.5;

– var num3=888.12;

8. What are the two values considered as Boolean Data Type?

-true/false

9. What are the Composite Data Types?

a composite data type is any data types which can be constructed in a program using its programming language’s primitive data types and other composite types.

10. What are the Special Data types in JavaScript?

-null and undefined

sources:

http://msdn.microsoft.com/en-us/library/wts33hb3.aspx

http://en.wikipedia.org/wiki/Composite_data_type

http://oreilly.com/javascript/excerpts/learning-javascript/javascript-datatypes-variables.html

credit:

http://nicolelee397.wordpress.com

Intro to JavaScript

1.What is JavaScript?

– JavaScript is the world’s most popular programming language. It is the language for HTML and the web, for servers, PCs, laptops, tablets, smart phones, and more.

2. What company started JavaScript?

– Netscape

3. Explain briefly the main difference of Java and JavaScript.

– Java is an OOP programming language while Java Script is an OOP scripting language.

– Java creates applications that run in a virtual machine or browser while JavaScript code is run on a browser only.

– Java code needs to be compiled while JavaScript code are all in text.

4. What are the things can we do to a webpage using JavaScript?

– Loading new page content or submitting data to the server via AJAX without reloading the page

– Animation of page elements, fading them in and out, resizing them, moving them

– Interactive content, for example game

– Transmitting information about the user’s reading habits and browsing activities to various websites.

5. Where do we write JavaScript codes? On which programs/applications?

– there are 2 ways to write your JavaScript code. The first is by embedding the code in your HTML document. we do this by using the opening and closing script tags, defining the script type & typing our code. The second method is to write our code in an external file. This benefit of this method is that we can run the same code on multiple pages if necessary.

6. How can we see the result of our JavaScript code?

– you can take any script that yo have written or any script that you have obtained from a script library and convert it from being coded into the page into an externally referenced JavaScript file.

7. What is the HTML tag to start a JavaScript code?

– <script>

document.write(“Hello World!”)

</script>

8. What is a variable? How is it different to a value?

– a variable’s purpose is to store information so that it can be used later, it is a name identifier that represents some data that you set.

– in variable, you can make changed but value is constant, its palace is in Readonly memory means you can’t means you can’t make changes to it.

9. What are the data types in JavaScript?

– primary data type: String, Number, Boolean

– composite data type: Object, Array

– special data type: null, undefined

10. How do we write comments in JavaScript?

– The following example uses single line comments to explain the code:

// Write to a heading:
document.getElementById(“myH1″).innerHTML=”Welcome to my Homepage”;
// Write to a paragraph:
document.getElementById(“myP”).innerHTML=”This is my first paragraph.”;

Sources:

http://www.w3schools.com/js/js_intro.asp

http://www.java.com/en/download/faq/java_javascript.xml

http://en.wikipedia.org/wiki/JavaScript

http://www.w3schools.com/tags/tag_script.asp

http://msdn.microsoft.com/en-us/library/ie/7wkd9z69%28v=vs.94%29.aspx

My Wish for Bangkok

What come through your mind when you heard the word “Bangkok”? Does it mean a beautiful place for you? Many people might have different opinion and feeling toward Bangkok. For me, I think bangkok was quite a beautiful and nice place. There are many attractive places to go on holidays, many beautiful things with cheap price, lots of delicious foods as well, and many other things. But still, there are some problems that need to be solve in the city in order to make it a better place.

The first main problem as everyone known is pollution. Thailand has a lot of pollution compare to other countries which cause many diseases to people who often breathing in the air. The pollution could comes from every where whether it’s from factories, buses, cars, etc. and it stays in the cair in Bangkok everyday. It was shocking me that Bangkok’s famous tuk-tuk drivers have the highest cancer rates in the world, and this is because they spending everyday sitting on pollution-chocked streets. Even though, there are many commercials, posters, or news that encourage people to stop causing pollution, but it seem doesn’t work well. To reduce the air pollution and stop people from getting the cancer cause by the pollution, the Thai government should be more serious and spending more times fixing this problems. And one of the best way to solve this problem is to have automated traffic lights. Since nowadays, the traffic lights are controlled by the police, and most of them didn’t even care much about the traffic jams. Therefore, people have to be sitting in their car and wait for an hour which is why there are many pollution. To end this problem, Thailand should better has an automated traffic light. This would surely help the city to reduce Bangkok pollution and terrible traffic jams.

The second problem that I think should be solve is the traffic james which is all around the bangkok nowadays. No matter where you are going, what times are you going, you will still met traffic jam. Since that populations keep on increasing, people keep on buying news cars. Therefore, traffic jams stay in the city everyday. This is also because of the roads. Some of them are too narrow and rocky, therefore it cause people to drive slower and this is the reason for traffic jams. The Thai government has been discuss about this for so many times, but they never did it. To stop the endless traffic jams, I think people should stop buying so many cars. There are many public transportation ready for you to used such as BTS, taxis, buses, etc. this would save you time and you would be able to have more times to do other things which would be better than sitting in the car and waiting forever.

There are still more problems waiting to solve, these are just the two main one. If the government be more serious and spending more times fixing the problems, the city would be having less pollution and traffic jams. This would surely make Bangkok become the better place! 

Introduction to CSS

1. What is CSS and what it is for?
– CSS stands for Cascading Style Sheets. It used to defines how HTML elements are to be displayed.
2. What is Internal Stylesheet, External Stylesheet, and Inline Styles?
– Internal Styles are defined in the head section of a given web page.
– External Styles are defined on the external style sheets, which is linked to the web pages.
– Inline Styles are defined within the HTML markup of a particular page element.
3. What is syntax?
– It’s the rules to follow. (just like English; it has grammar)
4. What are the three parts of a CSS syntax?
– a selector,property, and value.
5. How does Inheritance works in CSS?
– Inheritance in CSS, when applied to to an element in a document, a property with the value “inherit” will use the same value as the parent element has for that property. The values are inherited by the children of an element in the document tree.
6. What is a comment in coding and how do you write a comment in CSS and HTML?
– A comment in coding is a string of code within HTML, XML, and CSS that is unable to see or acted upon by the browser or parser. To write a comments in CSS and HTML, you surround the text you want commented out with

http://www.expression-web-tutorial.com/Types_CSS_Styles.html#.UOzCzq6Dj3A
http://www.w3schools.com/css/css_intro.asp
http://cssproperty.com/tutorial/what-is-css-syntax/
http://webdesign.about.com/od/beginningtutorials/a/aa050503a.htm
http://www.w3.org/TR/CSS21/cascade.html#inheritance

What Did I learn in ICT Class

I had learn many things in ICT class this semester. The first thing that I learn is Camtasia. Camtasia is a video editing software program. This software is installed on your computer and it allow your screen capture to be directly recorded to a digital, because it has a higher quality audio. And you can also chosen whether you will capture the entire screen,or specific window. After finish recording the screen, you can save and edit the video. This software program has many editing tools such as cut (to cut out the pat that you don’t want), split (to divide a single video clip into two or more clips), callout (for you to add texts), and also zoom-n-pan (to zoom the area you want).

The second I learn this this semester is Adobe Flash. It’s a software for animation. I had did many works in Flash. The first work that I had done is drawing DOMO. You can also making a video animation showing the different between heavy, elastic, and light objects. There is rotate and perspective animation, and alpha transparent effect as well. You can make the animation smooth and interesting by using frame rate or fps. The Adobe Flash is just simply amazing and interesting.

And lastly I learn about the HTML by using notepad++. We use HTML to create web pages. I had learn how to make text styles such as italic and bold. I also learned how to link webpages in my html and add pictures, change the picture size, and change the size of the picture’s border. I learned how to make tables and how to add column span and row span to the table. Some of the other things I learned are: linking other html work into my html, separating text into paragraphs, and make bullet points.

Table Samples

TABLE SAMPLES

Table A

Row1,C1 Row1,C2 Row1,C3
Row2,C1 Row2,C2 Row2 C3
Row3,C1 Row3,C2 Row3,C3

Table B

Row1,C1 Row1,C2 Row1,C3
Row2,C1 Row2,C2
Row3,C1 Row3,C2 Row3,C3

Table C

Row1,C1 Row1,C2 Row1,C3
Row2,C1 Row2,C2 Row2 C3
Row3,C1 Row3,C3

Table D

Row1,C1 Row1,C2 Row1,C3
Row2,C2 Row2 C3
Row3,C3

Internet and WWW

The Differences of Internet and World Wide Web

Many people think that the terms Internet and World Wide Web are just similar, but actually these two words are not synonymous. The Internet and The World Wide Web are two separate but related things. The Internet is a massive network of networks. It connects many computers together, forming a network which allow any computer to communicate with any other computer as long as they are both connected to the internet. While the World Wide Web is a way of accessing information over the medium of the Internet. It’s an information-sharing model that is built on top of the Internet. And this is the difference between them.

Tim Berner-Lee

Sir Timothy John “Tim” Berners-Lee also known as “TimBL”, he was a British computer scientist and the inventor World Wide Web. In March 1989, he made a proposal for an information management system. And on 25 December 1990, with the help of Robert Cailliau and a young student at CERN, he apply the first successful communication between a Hypertext Transfer Protocol (HTTP) client and server via the Internet.

Tim Berners-Lee is the director of the World Wide Web Consortium (W3C), which oversees the Web’s continued development. He was a director of the Web Science Trust (WST) launched in 2009 research and education in Web Science as well. At the MIT C computer Science and Artificial Intelligence, he is also the founder of the World Wide Web Foundation, and a senior researcher and holder of the Founders Chair.

websites reference: 

http://www.webopedia.com/DidYouKnow/Internet/2002/Web_vs_Internet.asp

http://www.w3.org/People/Berners-Lee/

 

http://inventors.about.com/od/istartinventions/a/internet.htm