week 7

Let's look at our created code, compare your code against ours! A great to use is Diffchecker 

Implement script:

We will follow further examples of Javascript's. using the examples that we previously went over in the past weeks we will now look at deeper and more involved scripts. However, as part of a recap, we shall go over these in a step by step process.

What do we understand so far?

 

 

 

appropriate objects eg properties, methods;

From the past examples and tutorials we have covered the implementation of scripts but at times we have not fully understood the process or actions associated to them here we will revisit these and contextualise them to specific examples that will enable better understanding and clarification of these objects.

STRING'S - Possibly the most used and most recognisable is the humble string. Strings are able to store a set of characters, the most obvious would be something like a name.  Within Javascripts strings can be inside of single and double quotation marks.

The code pen below shows this in operation.

It is also at this point worth noting that these are also declared as variables with the name of sweetname.

STRINGS

Strings can have set properties and methods which allow for further operations to be done and used.

The below example demonstrates the PROPERTY of string length, this will read the string and count its length in characters and then output its value into a variable that is then called and output to the webpage by getting the p tag to insert the value inside. 

 

Numbers

Numbers are used quite frequently in Javascript, be them declared values of variables or a counter that allows for a triggerable event to happen. These numerical values can be written in whole number form or as a decimal. When declaring a numerical value in Javascript you do not need to surround these in speech marks.

If you need to write a very large number, Javascript allows you to use the scientific values, for example,

var x = 123e5; is the equivalent to 12300000

var y = 123e-5; is the equivalent to 0.00123

Operators

There are a number of operators in Javascript, these are very much a language-independent set of operators and understanding these here will put you in a good position going onwards with future units. 

Addition: the + (plus) symbol is used in a process to add values together, for example A + B = C

Subtration: The - (subtraction) symbol is used in a process to minus a value from another, for example A - B = C

Incrimentation: The ++ (double add) symbol is used in Javascripts to allow the value contained within a variable to have its value incremented by a value, normally, in most cases by 1, for example a X = ++Y

Decriment: The --(double minus) symbol is used in Javascritps to allow the value contained within a variable to be reduced by a value of 1, for example X= --Y

Statements

Statements are instructions that tell the browser what to do, for example, code that instucts the browser to write to a value to the browser window.

Arrays

Arrays are used in cases where variables can have more than one set value, for example Trees = Oak, Birch, Maple, Chestnut, Hazel the way in which we can present these are as follows,

Now that you have a better understanding of these core components of Javascripts, revisit your examples that you have created and copied from W3Schools and from MyStudentSite and add further comments to your scripts to enable you to provide yourself with pause/reflection points for later.

writing eg required functions;

 

creation of web pages eg rollovers, clocks, calendars, client-side calculations, forms validation, mouse movement followers

 

. Getting Started with Programming 12 - 20

Demonstrate console.log and recognise comparison operators ( '<', '>', '==', '!==')

• Understand and construct if / else statements using comparison operators

• Understand and practice debugging

• Review data types, comparators, if / else statements and maths operations

• Understand and implement modulo (%) using an if / else statement

 

L2/4 programming AL

L3 algorithms AL

1. Getting Started with Programming 21 - 28

• Understand and practice implementing the substring keyword

• Understand and practice using variables

• Review variables and manipulation of numbers & strings

• Practice using variables in if / else statements

L3/5 programming

 

 

2.Choose Your Own Adventure 1 - 7

Plenary activity synthesising Module 1: Getting started with programming

• Assign prompt to a variable, construct if / else statements with comparison

operators and use console.log

L3 programming

L4 algorithms

 

Using mathematical operators, find the min, max and total of 10, 837, 267, 94, 293, 2, 112, 398, 62, 928, 737, 918.


Last Updated
2018-04-16 13:27:00

Links to Learning Outcomes

Links to Assessment criteria

 


English

Key Term

syntax - the structure of statements in a computer language.

Variable - a data item that may take on more than one value during the runtime of a program


Maths

An operator is a mathematical symbol l used in a calculation or comparison.

 



A prompt box can take an input from a user and has this syntax: x=prompt("message"," ").

  1.  Create the pizza topping example of a function.
  2. Adapt the code to allow the user to enter their favourite food type. If it is pizza, it should call the topping function.



How 2's Coverage

One-Minute Verbal Assessment - The teacher asks learners to prepare and deliver a one minute verbal summary of a forthcoming or completed activity, session or topic.



Anonymous Assessment - Learners assess an anonymous piece of work containing deliberate mistakes against given success criteria.

Files that support this week


| | | | |
Week 6
Prev
Week 7
Prev
Week 8
Prev

Next

Next
Webmaster Spelling Notifications