*
Previous JavaScript question answers 141-160 JavaScript question answers 181-200 Next

JavaScript Question Answers - 161-180

161. Which method sets the year of a date object, according to universal time (four digits)

date.setUTCFullYear(year)

162. Which method sets the hour of a date object, according to universal time

date.setUTCHours(hour)

163. Which method sets the milliseconds of a date object, according to universal time

date.setUTCMilliseconds(ms)

164. Which method sets the minutes of a date object, according to universal time

date.setUTCMinutes(min)

165. Which method sets the month of a date object, according to universal time

date.setUTCMonth(month)

166. Which method sets the seconds of a date object, according to universal time

date.setUTCSeconds(sec)

167. Which method removes the first element of an array, and returns that element

arr.shift()

168. Which method returns the sine of x (x is in radians)

Math.sin(x)

169. What does "1"+2+4 evaluate to?

It evaluates to "124" (string concatenation).

170. How about 2+5+"8"?

It evaluates to "78" (numbers added first, then concatenated with string).

171. Which method selects a part of an array, and returns the new array

arr.slice(start, end)

172. Which method extracts a part of a string and returns a new string

str.slice(start, end)

173. In JavaScript how to display a string using a small font

document.write("Hello".small());

174. Which method sorts the elements of an array

arr.sort()

175. Which method adds/removes elements from an array

arr.splice(start, deleteCount, item1, ...)

176. Which method splits a string into an array of substrings

str.split(separator)

177. Which method returns the square root of x

Math.sqrt(x)

178. Which property returns the square root of 1/2 (approx. 0.707)

Math.SQRT1_2

179. Which property returns the square root of 2 (approx. 1.414)

Math.SQRT2

180. Which method sets or returns the text in the statusbar of a window

window.status

Back to Index
Previous JavaScript question answers 141-160 JavaScript question answers 181-200 Next
*
*