The selected() method, called without any parameters, will return all selected items' index of the ComboBox widget.
The selected(index, bool) method is used to select or unselect(depending on second boolean parameter) particular item on the passed index position.

<input id="combo" ></input>

<script type="text/javascript">

    $(function () {
            dataSource: {
			    data: countries
		    textTemplate: "{name}",
		    valueTemplate: "{code}",
            inputTemplate: "{name}"

        $("#combo").swidget().selected(); // return empty array
        $("#combo").swidget().selected(0, true) // select the first item
        $("#combo").swidget().selected(); // return array with one element - the selected item's index - 0