Associative Array
In the script below, we create the basis for a Acronym Lookup program in JavaScript. We will use an associative array to reference the meaning of each acronym, and use the acronym as the associative array's index:
We have three associative arrays: MPLS (links the Multi-Protocol Label Switching), SSTP (links the Secure Socket Tunneling Protocol), and LDAP (links the Lightweight Directory Access Protocol).
Example: 1
<script type="text/javascript">
var Protocols = new Array();
Protocols["MPLS"]="Multi-Protocol Label Switching";
Protocols["SSTP"]="Secure Socket Tunneling Protocol";
Protocols["LDAP"]="Lightweight Directory Access Protocol";
document.write("MPLS stands for: " +Protocols["MPLS"]+"<br>");
document.write("SSTP stands for: " +Protocols["SSTP"]+"<br>");
document.write("LDAP stands for: " +Protocols["LDAP"]+"<br>");
</script>
No comments:
Post a Comment