The age of the forest is the time since forest (re)-establishment. Forest (re)-establishment is defined as the year where TCC reaches certain threshold as specified by country definition. The output value is years since forest establishment for pixels defined as forest in the year 2018.

The scripts look like below or use this link.

var mekong = ee.FeatureCollection('users/biplov/gadm-mekong'),
    tcc = ee.ImageCollection('projects/servir-mekong/yearly_primitives_smoothed/tree_canopy'),
    tch = ee.ImageCollection('projects/servir-mekong/yearly_primitives_smoothed/tree_height');

var tccThreshold = 10; // in percentage
var tchThreshold = 5; // in meter

var years = ee.List.sequence(2000, 2018);

var combineDatasets = function (year) {
    var _tcc = tcc.filterDate(ee.Date.fromYMD(year, 1, 1), ee.Date.fromYMD(year, 12, 31)).first();
    _tcc = _tcc.rename(['tcc']);
    var _tch = tch.filterDate(ee.Date.fromYMD(year, 1, 1), ee.Date.fromYMD(year, 12, 31)).first();
    _tch = _tch.rename(['tch']);
    return _tcc.addBands(_tch);
};

var combinedData = ee.ImageCollection.fromImages(years.map(combineDatasets));

var calculateForestMap = function (image) {
    var _tcc = image.select('tcc').gte(tccThreshold);
    var _tch = image.select('tch').gte(tchThreshold);
    return _tcc.and(_tch).rename(['forest']).copyProperties(image, image.propertyNames());
};

var forestMapCollection = combinedData.map(calculateForestMap);

// This is a function to pass to Iterate().
// As images are computed and added to the list.
var accumulate = function(image, list) {

    // get(-1) the last image in the image collection
    var previous = ee.Image(ee.List(list).get(-1)).toUint8();

    var added = previous.add(image).set('system:time_start', image.get('system:time_start'));
    // set the value for a pixel to zero which is not forest
    added = added.where(image.eq(0), 0);
    // Return the list
    return ee.List(list).add(added.toUint8());
};

var firstDate = forestMapCollection.first().get('system:time_start');
// The first image in the list is just 0; keep adding to get the age that meets criteria
var firstImage = ee.Image(0).toUint8().set('system:time_start', firstDate).select([0], ['forest']);
var collection = ee.List([firstImage]);
// Create an ImageCollection of cumulative anomaly images by iterating.
var cumulative = ee.List(forestMapCollection.iterate(accumulate, collection));
cumulative = cumulative.remove(cumulative.get(0));
var age = ee.Image(cumulative.get(-1));
age = age.updateMask(age.gt(0)).clip(mekong);
Map.addLayer(age, {min:1, max:31, palette:'teal,blue,orange,green,red'}, 'age');

Happy Earth Science 🙂