JavaScript Arrays Date

Slides:



Advertisements
Similar presentations
Lesson 4: Formatting Input Data for Arithmetic
Advertisements

JAVASCRIPT TIPS. REMEMBER JAVASCRIPT IS VERY, VERY CASE SENSITIVE.
JavaScript Events and Event Handlers 1 An event is an action that occurs within a Web browser or Web document. An event handler is a statement that tells.
Using Object-Oriented JavaScript CST 200- JavaScript 4 –
Arrays, date, random. Declared Variables Explicitly define them Can give them starting values Figures out type Case sensitive var x = 5; (note: this is.
Keeping it Neat: Functions and JavaScript Source Files Chapter 7.
Input & Output Functions JavaScript is special from other languages because it can accept input and produce output on the basis of that input in the same.
CONDITIONALS DATE CHANGES OUTSIDE FORMS. CONDITION ALS.
JavaScript Functions. CSS Inheritance Which formatting applies? x y z input { display: block; } input.pref { background:red; } If you have a selector.
Spotlight on Word Processing
5 Day Forecast Mon Tues Wed Thu Fri.
2015 monthly calendar template
LINE graphs SPI & SPI SPI & SPI
Java String and Date ISYS 350.
2016 monthly calendar template
© Copyright 2016, Fred McClurg All Rights Reserved
JavaScript Forms Adding User Input.
GANTT CHARTS Example Example Example Example text Tasks Example 1
Time Revision.
Java Date ISYS 350.
BY: SITI NURBAYA ISMAIL FACULTY of COMPUTER and MATHEMATICAL SCIENCES
به نام خداوند خورشید و ماه
2018 monthly calendar template
MON TUE WED THU
GANTT CHARTS Example Text Text Here Text Here Text Here Text Here
January MON TUE WED THU FRI SAT SUN
January MON TUE WED THU FRI SAT SUN
Preschool Times and Rates 2 year 3 year 4 year
2020 monthly calendar template
January Sun Mon Tue Wed Thu Fri Sat
January MON TUE WED THU FRI SAT SUN
January MON TUE WED THU FRI SAT SUN
Java Date ISYS 350.
JavaScript onLoad arrays
2017 monthly calendar template
2019 monthly calendar template
2019 monthly calendar template
2016 monthly calendar template
2017 monthly calendar template
2014 monthly calendar template
2008 Calendar.
2010 monthly calendar template
2018 monthly calendar template
2020 monthly calendar template
January MON TUE WED THU FRI SAT SUN
Sun Mon Tue Wed Thu Fri Sat
2009 monthly calendar template
Hundred Dollar Questions
2016 monthly calendar template
January MON TUE WED THU FRI SAT SUN
Volunteer Opportunities
January MON TUE WED THU FRI SAT SUN
Sun Mon Tue Wed Thu Fri Sat
Introduction to MIS2402 MIS MIS2402 Jeremy Shafer Department of MIS
Name: ______________________________
1/○~1/○ weekly schedule MON TUE WED THU FRI SAT SUN MEMO
January MON TUE WED THU FRI SAT SUN
HTML Forms What are clients? What are servers?
S M T W F S M T W F
2016 | 10 OCT SUN MON TUE WED THU FRI SAT
Sun Mon Tue Wed Thu Fri Sat
WEB PAGES: Tables Welcome Back !.
Introduction to JavaScript
1 January 2018 Sun Mon Tue Wed Thu Fri Sat
My Life As A Procrastinator
义务教育教科书冀教版小学英语四年级上册第一单元
Online Registration at Stephen F. Austin State University
2008 Calendar.
Python Creating a calculator.
Presentation transcript:

JavaScript Arrays Date

Arrays

Producing different results We have looked at how to compute different numeric values Computation Random How do we create different strings? Can do it from user input But want to translate a number to a string Examples: Random facts Convert month or day number to string

Arrays Collection of related information Referenced with index Easy way to choose between items var array = [ “A", "B", “F", "G" ]; Just keep adding items! array[index] Start with 0 Example: Date returns number, you return that month

Create your first array Change a number to text Create a JavaScript function called spellIt Takes in a number from 0 to 9 Returns a string with the number name Call it with a button press, passing the user input

Date

Date() Returns a collection of information Year, month, day, hours, minutes, seconds, milliseconds

Date and Time Full date is unfriendly format To get today’s date: var d = new Date(); To get the time: var time = d.getHours(); To get the day: var theDay = d.getDay(); w3schools http://www.w3schools.com/js/js_date_methods.asp

What does day return? Number 0 to 6 Want to convert to Sunday, Monday, … var DayOfWeek = [“Sun”, “Mon”, “Tues”, “Wed”, “Thurs”, “Fri”, “Sat”];

Display the current month Create a JavaScript function called monthName To be in the same file as spellIt No parameters needed Returns a string with this month’s name

Extend spellIt Accept a number 20-29 and spell it out Subtract 20 twenty, twenty-one, twenty-two, …, twenty-nine Subtract 20 Will need to change the array to include - What should the 0 array value be?

HTML Page It should print the date of your last major assignment User enters a number between 20 and 29 Button press returns the month and date spelled out Example: Enter 27 Returns April twenty-seven