JSFiddle - React, Tailwind, and code Playground

by Lucille Kenney

HTML

<div id='output'></div>

JavaScript

function roundPenny(pendantCost){


        var str = pendantCost;
		var substr = str.split('.');
    
		// substr[0] contains "295"
		// substr[1] contains "5555"
    
    return substr;


// Test it
pendantCost = roundPenny(295.5555);
$('#output').html(pendantCost);