Busy. Please wait.
or

Forgot Password?

Don't have an account?  Sign up
or

taken

why

Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
We do not share your email address with others. It is only used to allow you to reset your password. For details read our Privacy Policy and Terms of Service.

Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.

Remove Ads
Don't know
Know
remaining cards
Save
0:01

 Flashcards Matching Hangman Crossword Type In Quiz Test StudyStack Study Table Bug Match Hungry Bug Unscramble Chopped Targets

Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

Normal Size     Small Size show me how

# JAVASCRIPT WEEK 4

QuestionAnswer
var numbers=new Array("5","12","8"); The numbers[1] is equal to : 12
var numbers=new Array("5","12","8"); document.write(numbers[3]); The code will display the third value of the array
var numbers=[25,19,34,17,30]; grades.sort(function(x, y){return x-y}); Array ascending sort
var numbers=[25,19,34,17,30]; grades.sort(function(x, y){return y-x}); Array descending sort
var colours = ["red", "blue", "yellow"]; document.write(colours.toString()); The result is: red, blue, yellow
var colours = ["red", "blue", "yellow"]; document.write(colours.join(" * ")); The result is: red*blue*yellow
var colours=["red", "blue", "yellow"]; colours.reverse(); The result is : yellow blue red
var colours=["red", "blue", "yellow"]; colours.pop(); The result is: red blue
var colours=["red", "blue", "yellow"]; colours.push("green"); The result is: red,blue,yellow,green
var colours=["red", "blue", "yellow"]; colours.shift(); The result of the code above is: blue,yellow
var colours=["red", "blue", "yellow"]; colours.unshift("green"); The result of the code above is: green,red,blue,yellow
var numbers = [10, 20, 40]; students.splice(2,0,30); The result of the code above is: 10,20,30,40
var str=new String("Unicaf University"); document.write(str); The result of the code above is: Unicaf University
var str=" Unicaf university "; var final_str=str.trim(); document.write(final_str); The result of the code above is: Unicaf university
var str ="UNICAF University"; document.write(str.toLowerCase()); The result of the code above is: unicaf university
var str ="unicaf university"; document.write(str.toUpperCase ()); The result of the code above is: UNICAF UNIVERSITY
var str1="Unicaf"; var str2="University"; var str_3=str_1.concat(str_2); document.write(str_3); The result of the code above is: Unicaf University
var str="unicaf university"; document.write(str.slice(7,10)); The result of the code above is: uni
var str="unicaf university"; document.write(str.chartAt (7)); The result of the code above is: u
var str="unicaf university"; document.write(str. indexOf("university")); The result of the code above is: 7
var colours=["red", "blue", "yellow"]; delete colours[0]; document.write(colours[0]); The result of the code above is: undefined
var colours1=["red", "blue"]; var colours2=["yellow", "green"]; var colours3=colours1.concat(colours2); The result of the code above is: red,blue,yellow,green
Created by: kcoulee