Answers for "java script reader"

1

filereader javascript example

//HTML
<input type='file' accept='image/*' onchange='openFile(event)'><br>
<img id='output'>

//Javascript
var openFile = function(event) {
  var input = event.target;

  var reader = new FileReader();
  reader.onload = function(){
    var dataURL = reader.result;
    var output = document.getElementById('output');
    output.src = dataURL;
  };
  reader.readAsDataURL(input.files[0]);
}
Posted by: Guest on May-22-2020
0

java script reader

function selection_sort(data) 
{ 
    for(let i = 0; i < data.length - 2; i++) 
    {
        // Finding the smallest number in the subarray
        let min = i;
        for(let j = i+1; j < data.length; j++)
        {
            if(data[j] < data[min]) 
            {
                min = j; 
            }            
         }
         swap_positions(data, i, min);
    }
    return data;
}

function swap_positions(data1, left, right)
{
    backup_old_data_right_value = data1[right];
    data1[right] = data1[left];
    data1[left] = backup_old_data_right_value;
    return data1;
}

let arr = [6, 9, 10, 5, 7, 11, 13, 3, 14, 12];
selection_sort(arr);
document.write(arr);
Posted by: Guest on July-01-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language