Page 236 - Web Applications (803) Class 12
P. 236

28.  Predict the output of the following:                                                     [2022 T2]
                     <html>

                     <body>
                     <script>
                     var str="Honesty is the best policy";
                     document.write(str.match("policy")+"<br>");
                     document.write(str.match("Police")+"<br>");
                     document.write(str.match("pollicy")+"<br>");
                     document.write(str.match("policy")+"<br>");
                     </script>

                     </body>
                     </html>
                Ans.  Output is:

                     policy
                     null
                     null
                     policy





















































                234   Touchpad Web Applications-XII
   231   232   233   234   235   236   237   238   239   240   241