How do I get the slug of a custom taxonomy category of a post?

This shouldn’t be too hard!

$my_terms = get_the_terms( $post->ID, 'portfolio' );
if( $my_terms && !is_wp_error( $my_terms ) ) {
    foreach( $my_terms as $term ) {
        echo $term->slug;
    }
}