JSFiddle - React, Tailwind, and code Playground

by onpati

JavaScript

function test(a) {
    if(a !== undefined) {
        $('body').html('employee id :'+a.empId);
    }
    else {
        $('body').html('a is undefined');
    }
    //var a = 'a is defined';
    var a = {empId:'003931',
             url : 'testUrl'}
    $('body').append('<br /><br />');
    $('<a href="#">test</a>').click(function(e) {
        e.preventDefault();
        test(a);
    }).appendTo('body');
}

$(document).ready(function() {
    test();
});