Home »
MCQs »
AngularJS MCQs
Write a statement with <div> element to initialize two variables (name and age)?
20. Write a statement with <div> element to initialize two variables (name and age)?
- <div ng-app="" ng-init="Name:'Alex';Age:21">
- <div ng-app="" ng-init="Name:'Alex',Age:21">
- <div ng-app="" ng-init="Name='Alex',Age=21">
- <div ng-app="" ng-init="Name='Alex';Age=21">
Answer: D) <div ng-app="" ng-init="Name='Alex';Age=21">
Explanation:
The correct statement to initiate the variables:
<div ng-app="" ng-init="Name='Alex';Age=21">