Simple JS Question

by KevinABoucher

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<h3>
  Output
</h3>
<div id='log'></div>

JavaScript

var endpoints = [ 'vSphere', 'NSX', 'Amazon', 'vRO', 'proxy'];
  var associations = [ 
    { toEndpoint: 'NSX', fromEndpoint: 'vSphere' },
    { toEndpoint: 'proxy', fromEndpoint: 'vSphere' },
    { toEndpoint: 'proxy', fromEndpoint: 'Amazon' }
  ];
  
function getAssociations (endpoint) {
  var result = [];
  // TODO
  return result;
}

// List all available associations for NSX - []
log(JSON.stringify(getAssociations('NSX')));

// List all available associations for vSphere - NSX, proxy
log(JSON.stringify(getAssociations('vSphere')));

// List all available associations for Amazon - proxy
log(JSON.stringify(getAssociations('Amazon')));

function log(str) {
  $('#log').append(str + '<br>');
}