1.

What is the code for getting the current time?(a) now = new Date();(b) var now = new Date();(c) var now = Date();(d) var now = new Date(current);The question was posed to me by my college director while I was bunking the class.This question is from Embedding JavaScript in HTML topic in portion Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct answer is (b) var now = new Date();

To explain I would SAY: Date() is a predefined FUNCTION in JAVASCRIPT which returns the date in string form. The above CODE determines the current TIME and stores it in the variable “now”.



Discussion

No Comment Found

Related InterviewSolutions