JSFiddle - React, Tailwind, and code Playground

by leonardo_ciaccio

HTML

<div class="response"></div

JavaScript

// Suppress error, PHP @ equivalent

at = function( test ){
        
    try{
        
        if( typeof test === "function" )return test();
        
        return test || null;
    
    }catch( e ){
        
        return null;
    
    }
    
};

var a = [ "Hello", "World !" ];

// Example
$( ".response" ).append( 

    at( a[ 173 ] ) || "My array have max 2 elements, not 173" + "<br>" 

);

$( ".response" ).append( 

    at( a.join( " " ) ) + "<br>" 

);

// Suppress error
$( ".response" ).append( 

    at( function( mex ){
    
        throw new Error( mex );
    
    } ) || "Ehmmmm !" 

);